Permalink
Browse files

Updated probability_plot

  • Loading branch information...
1 parent 95e6504 commit c63438007ae10056316ce837251a170f1204fdc4 @orbitfold committed Aug 9, 2012
Showing with 6 additions and 6 deletions.
  1. +1 −1 pandas/tests/test_graphics.py
  2. +5 −5 pandas/tools/plotting.py
@@ -91,7 +91,7 @@ def test_probability_plot(self):
from pandas.tools.plotting import probability_plot
_check_plot_works(probability_plot, self.ts)
_check_plot_works(probability_plot, self.ts, marker='+', color='black')
- _check_plot_works(probability_plot, self.ts, dist='cauchy', sparams=(1.0, 0.01), marker='+', color='black')
+ _check_plot_works(probability_plot, self.ts, dist='cauchy', distargs=(1.0, 0.01), marker='+', color='black')
class TestDataFramePlots(unittest.TestCase):
View
@@ -202,7 +202,7 @@ def lag_plot(series, ax=None, **kwds):
ax.scatter(y1, y2, **kwds)
return ax
-def probability_plot(series, ax=None, dist='norm', sparams=(), **kwds):
+def probability_plot(series, ax=None, dist='norm', distargs=(), **kwds):
"""Probability plot for uni-variate data.
Parameters:
@@ -211,26 +211,26 @@ def probability_plot(series, ax=None, dist='norm', sparams=(), **kwds):
ax: Matplotlib axis object, optional
dist: Distribution name, one supported by scipy
http://docs.scipy.org/doc/scipy/reference/stats.html#continuous-distributions
- sparams: Distribution parameters (location, scale).
+ distargs: Distribution specific parameters usually location and scale.
kwds: Matplotlib scatter method keyword arguments, optional
Returns:
--------
- ax: Matplotlib axis object
+ fig: Matplotlib figure object
"""
import matplotlib.pyplot as plt
from scipy.stats import probplot
if ax == None:
ax = plt.gca()
data = series.values
- (x, y), (slope, intercept, _) = probplot(data, dist=dist, sparams=sparams)
+ (x, y), (slope, intercept, _) = probplot(data, dist=dist, sparams=distargs)
ax.scatter(x, y, **kwds)
y1, y2 = ax.get_ylim()
x1, x2 = (y1 - intercept) / slope, (y2 - intercept) / slope
ax.plot([x1, x2], [y1, y2], color='grey')
ax.set_xlabel("Theoretical Quantiles")
ax.set_ylabel("Sample Quantiles")
- return ax
+ return ax.get_figure()
def autocorrelation_plot(series, ax=None):
"""Autocorrelation plot for time series.

0 comments on commit c634380

Please sign in to comment.