5
5
from . import validate
6
6
7
7
8
- def probplot (data , ax = None , color = None , label = None , axtype = 'prob ' ,
9
- probax = 'x' , otherscale = 'linear' , xlabel = None , ylabel = None ,
10
- bestfit = False , return_results = False , scatter_kws = None ,
11
- line_kws = None , pp_kws = None ):
8
+ def probplot (data , ax = None , axtype = 'prob' , dist = None , probax = 'x ' ,
9
+ color = None , label = None , otherscale = 'linear' , xlabel = None ,
10
+ ylabel = None , bestfit = False , return_results = False ,
11
+ scatter_kws = None , line_kws = None , pp_kws = None ):
12
12
""" Probability, percentile, and quantile plots.
13
13
14
14
Parameters
@@ -18,17 +18,20 @@ def probplot(data, ax=None, color=None, label=None, axtype='prob',
18
18
ax : matplotlib axes, optional
19
19
The Axes on which to plot. If one is not provided, a new Axes
20
20
will be created.
21
+ axtype : string (default = 'prob')
22
+ Type of plot to be created. Options are:
23
+ - 'prob': probabilty plot
24
+ - 'pp': percentile plot
25
+ - 'qq': quantile plot
26
+ dist : scipy distribution, optional
27
+ A distribtion to compute the scale's tick positions. If not
28
+ specified, a normal distribution will be used.
21
29
color : valid matplotlib color specification, optional
22
30
If provided, this value will be added to the ``scatter_kws``
23
31
and ``line_kws`` dictionary under the "color" key.
24
32
label : string, optional
25
33
If provided, this legend label is applied to the scatter series
26
34
of the probability plot.
27
- axtype : string (default = 'prob')
28
- Type of plot to be created. Options are:
29
- - 'prob': probabilty plot
30
- - 'pp': percentile plot
31
- - 'qq': quantile plot
32
35
probax : string, optional (default = 'x')
33
36
The axis ('x' or 'y') that will serve as the probability (or
34
37
quantile) axis.
@@ -69,6 +72,9 @@ def probplot(data, ax=None, color=None, label=None, axtype='prob',
69
72
70
73
"""
71
74
75
+ if dist is None :
76
+ dist = _minimal_norm
77
+
72
78
# check input values
73
79
fig , ax = validate .axes_object (ax )
74
80
probax = validate .axis_name (probax , 'x' )
@@ -102,7 +108,7 @@ def probplot(data, ax=None, color=None, label=None, axtype='prob',
102
108
if probax == 'x' :
103
109
x , y = probvals , datavals
104
110
if axtype == 'prob' :
105
- ax .set_xscale ('prob' )
111
+ ax .set_xscale ('prob' , dist = dist )
106
112
fitprobs = 'x'
107
113
else :
108
114
fitprobs = None
@@ -116,7 +122,7 @@ def probplot(data, ax=None, color=None, label=None, axtype='prob',
116
122
elif probax == 'y' :
117
123
y , x = probvals , datavals
118
124
if axtype == 'prob' :
119
- ax .set_yscale ('prob' )
125
+ ax .set_yscale ('prob' , dist = dist )
120
126
fitprobs = 'y'
121
127
else :
122
128
fitprobs = None
@@ -141,7 +147,7 @@ def probplot(data, ax=None, color=None, label=None, axtype='prob',
141
147
142
148
# maybe do a best-fit and plot
143
149
if bestfit :
144
- xhat , yhat , modelres = _fit_line (x , y , fitprobs = fitprobs , fitlogs = fitlogs )
150
+ xhat , yhat , modelres = _fit_line (x , y , fitprobs = fitprobs , fitlogs = fitlogs , dist = dist )
145
151
ax .plot (xhat , yhat , ** line_kws )
146
152
else :
147
153
xhat , yhat , modelres = (None , None , None )
0 commit comments