0

Using statsmodels.api to produce a qqplot leads to doubling the expected plot, with a strange positioning of the titles, and 2 different plot sizes...

The following small code is an example I made to explain / show the situation.

How could I modify this code to just have the expected qqplot produced ?

Note - working on:

Python 3.13.2
matplotlib: 3.10.3
statsmodels: 0.14.4
seaborn: 0.13.2

Example :

import matplotlib.pyplot as plt
import seaborn as sns
plt.style.use('seaborn-v0_8')
import statsmodels.api as sm

data = [0.6, 5.2, 7.1, 7.4, 7.9, 9.4, 9.5, 10.3, 10.4]
data_norm = ( data - np.mean(data) ) / np.std(data)

fig, ax = plt.subplots(figsize=(6, 3))

sm.qqplot(data_norm, line = '45', fit = True, markersize  = 3)

plt.suptitle("Minimum distance", fontsize = 16, y = 1.05)
ax.set_title("Quantile-Quantile Plot for distance data", fontsize = 12)

plt.show()

What I get:

enter image description here

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.