'Why are my box plot and probability plot overlapping

I'm trying to plot Histograms, Probability Plots, and Boxplots, however, boxplots and prob plots overlap:

This is the code in Python (Jupyter Notebook):

def outlier_plot(df, variable):
    plt.figure(figsize = (16, 4))
    
    plt.subplot(1,3,1)
    sns.histplot(df[variable], bins = 30)
    plt.title("Histogram"),
    
    plt.subplot(1,3,3)
    stats.probplot(df[variable], dist="norm",plot=plt)
    plt.ylabel("RM Quantiles"),
    
    plt.subplot(1,3,3)
    sns.boxplot(y=df[variable])
    plt.title("Boxplot")
    
    plt.show()

for i in num_cols:
    outlier_plot(df,i)


Solution 1:[1]

It may be because your code for your prob plots has the incorrect subplot coordinates.

So instead of:

plt.subplot(1,3,3)
stats.probplot(df[variable], dist="norm",plot=plt)
plt.ylabel("RM Quantiles"),

Try:

plt.subplot(1,3,2)
stats.probplot(df[variable], dist="norm",plot=plt)
plt.ylabel("RM Quantiles"),

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1