简体   繁体   中英

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()

在此处输入图像描述

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

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

更正大师QQ

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM