probplot
기능은 플롯을 사용자 정의하는 API를 노출하지 않습니다. 대신 matplotlib
(즉 pylab
) 함수를 사용하여 probplot
이 반환 된 다음 플롯을 사용자 정의 할 수 있습니다. 여기 당신이 그것을 할 수있는 한가지 방법이 있습니다 (ipython 세션에서).
우선, 수입 :
In [107]: pp = stats.probplot(x, dist=stats.gamma, sparams=(2.74,), plot=pylab)
첫 번째 행의 alpha
값을 설정
In [105]: np.random.seed(8675309)
In [106]: x = np.random.gamma(3.0, scale=2.1, size=50)
이 확률 플롯 생성 :
In [102]: import numpy as np
In [103]: import pylab
In [104]: from scipy import stats
플롯에 대한 일부 데이터를 생성 현재 축에서. 이것은 빨간 선을 그리기 전에 점을 그려야하는 probplot
에 의존하기 때문에 약간 위험합니다.

는 개인적으로하지만, 나는 음모를 꾸미고을 완전히 제어하는 것을 선호 :
In [108]: ax = pylab.gca() # Get the current axes.
In [109]: line0 = ax.get_lines()[0] # Get the first "line" in the axes.
In [110]: line0.set_alpha(0.25) # Set the alpha for the "line".
다음은 생성되는 플롯이다. 당신은 플롯의 자동 생성을 해제 할 수있는
plot
인수
None
를 전달할 수 있습니다, 당신은
matplotlib
를 사용하는 것과 같이 그러나 플롯을 생성합니다
In [185]: import matplotlib.pyplot as plt
In [186]: (osm, osr), (slope, intercept, r) = stats.probplot(x, dist=stats.gamma, sparams=(2.74,), plot=None)
In [187]: plt.plot(osm, osr, 'o', alpha=0.5)
Out[187]: [<matplotlib.lines.Line2D at 0x11469a6d8>]
In [188]: plt.plot(osm, slope*osm + intercept, 'k', alpha=0.5, linewidth=1)
Out[188]: [<matplotlib.lines.Line2D at 0x114695a90>]
In [189]: plt.grid(alpha=0.15)
In [190]: plt.xlabel('Theoretical Quantiles')
Out[190]: <matplotlib.text.Text at 0x11440bac8>
In [191]: plt.ylabel('Sample Quantiles')
Out[191]: <matplotlib.text.Text at 0x1142efda0>

이 환상적이다. 고맙습니다. – JAG2024