Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Labels inverted in statsmodels QQ plot in python?

I am wondering whether there is a bug in the statsmodels module function qqplot_2samples().
The documentation (https://www.statsmodels.org/stable/generated/statsmodels.graphics.gofplots.qqplot_2samples.html) says that the first parameter is the x data and the second parameter is y data. Then you can define xlabel and ylabel to give a name to each axis.

I tried with my data and I think the axis titles are inverted.

import statsmodels.api as sm
import numpy as np
import matplotlib.pyplot as plt 

x_data = np.arange(10)
y_data = np.arange(10,20)

x = sm.ProbPlot(x_data)
y = sm.ProbPlot(y_data)

sm.qqplot_2samples(x,y, xlabel="x", ylabel="y")
plt.show()

enter image description here

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Unless I’m missing something on what this functions does, the y-axis is the one going to 20, not the x.

>Solution :

This has been fixed in master and will be out in the 0.14 release. Running your code now produces:

Corrected QQ in master

You can install the master version one of two ways:

  1. If you have a C compiler installed, you can use pip install git+https://github.com/statsmodels/statsmodels.git
  2. If you don’t, you can install a recent build using pip install -i https://pypi.anaconda.org/scipy-wheels-nightly/simple statsmodels. These are official nightly wheels.
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading