Skip to content

Commit b5433aa

Browse files
committed
Merge pull request #29 from phobson/docs-2
minor doc cleanups
2 parents 528026a + 695cfae commit b5433aa

File tree

7 files changed

+33
-41
lines changed

7 files changed

+33
-41
lines changed

docs/conf.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@
8585
# built documents.
8686
#
8787
# The short X.Y version.
88-
version = '0.1.2'
88+
version = '0.2.0'
8989
# The full version, including alpha/beta/rc tags.
90-
release = '0.1.2'
90+
release = '0.2.0'
9191

9292
# The language for content autogenerated by Sphinx. Refer to documentation
9393
# for a list of supported languages.

docs/tutorial/closer_look_at_viz.ipynb

+2-2
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@
552552
"source": [
553553
".. note::\n",
554554
" The ``probplot`` function can take two additional aesthetic parameters:\n",
555-
" `color` and `label`. If provided `color` will override the marker face color\n",
555+
" `color` and `label`. If provided, `color` will override the marker face color\n",
556556
" and line color options of the `scatter_kws` and `line_kws` parameters, respectively.\n",
557557
" Similarly, the label of the scatter series will be overridden by the explicit parameter.\n",
558558
" It is not recommended that `color` and `label` are used. They exist primarily for \n",
@@ -605,7 +605,7 @@
605605
" Used for Gumble distributions.\n",
606606
" \n",
607607
"These are controlled via the `pp_kws` parameter in `probplot`\n",
608-
"and are discussed in much more detail in the next tutorial`.\n"
608+
"and are discussed in much more detail in the next tutorial.\n"
609609
]
610610
},
611611
{

probscale/formatters.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ def _sig_figs(cls, x, n, expthresh=5, forceint=False):
2929
3030
Examples
3131
--------
32-
>>> print(_sig_figs(1247.15, 3))
33-
1250
34-
>>> print(_sig_figs(1247.15, 7))
35-
1247.150
32+
>>> _sig_figs(1247.15, 3)
33+
'1250'
34+
>>> _sig_figs(1247.15, 7)
35+
'1247.150'
3636
3737
"""
3838

@@ -121,7 +121,7 @@ class ProbFormatter(_FormatterMixin):
121121
>>> from probscale import formatters
122122
>>> fmt = formatters.ProbFormatter()
123123
>>> fmt(0.01)
124-
'0,01'
124+
'0.01'
125125
>>> fmt(0.2)
126126
'0.20'
127127
>>> try:

probscale/probscale.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ class ProbScale(ScaleBase):
8484
8585
>>> from matplotlib import pyplot
8686
>>> import probscale
87-
>>> fig, ax = pyplot.subplots()
88-
>>> ax.set_ylim(bottom=0.2, top=99.9)
87+
>>> fig, ax = pyplot.subplots(figsize=(4, 7))
88+
>>> ax.set_ylim(bottom=0.5, top=99.5)
8989
>>> ax.set_yscale('prob')
9090
9191
"""

probscale/tests/test_probscale.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import sys
2-
PYTHON27 = sys.version_info.major == 2
32

43
import numpy
54
import matplotlib.pyplot as plt
@@ -15,6 +14,10 @@
1514
from probscale.probscale import _minimal_norm
1615

1716

17+
PYTHON27 = sys.version_info.major == 2
18+
TOLERANCE = 22
19+
20+
1821
@pytest.fixture
1922
def mn():
2023
return _minimal_norm()
@@ -72,7 +75,7 @@ def test_minimal_norm_cdf(mn, mn_input):
7275

7376
@pytest.mark.mpl_image_compare(
7477
baseline_dir='baseline_images/test_probscale',
75-
tolerance=15
78+
tolerance=TOLERANCE
7679
)
7780
@pytest.mark.skipif(PYTHON27, reason="legacy python")
7881
def test_the_scale_default():
@@ -85,7 +88,7 @@ def test_the_scale_default():
8588

8689
@pytest.mark.mpl_image_compare(
8790
baseline_dir='baseline_images/test_probscale',
88-
tolerance=15
91+
tolerance=TOLERANCE
8992
)
9093
def test_the_scale_not_as_pct():
9194
fig, ax = plt.subplots(figsize=(4, 8))

probscale/viz.py

+15-26
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,12 @@ def probplot(data, ax=None, plottype='prob', dist=None, probax='x',
2121
The Axes on which to plot. If one is not provided, a new Axes
2222
will be created.
2323
plottype : string (default = 'prob')
24-
Type of plot to be created. Options are:
24+
Type of plot to be created. Options are:
25+
2526
- 'prob': probabilty plot
2627
- 'pp': percentile plot
2728
- 'qq': quantile plot
29+
2830
dist : scipy distribution, optional
2931
A distribtion to compute the scale's tick positions. If not
3032
specified, a standard normal distribution will be used.
@@ -67,7 +69,8 @@ def probplot(data, ax=None, plottype='prob', dist=None, probax='x',
6769
fig : matplotlib.Figure
6870
The figure on which the plot was drawn.
6971
result : dictionary of linear fit results, optional
70-
Keys are:
72+
Keys are:
73+
7174
- q : array of quantiles
7275
- x, y : arrays of data passed to function
7376
- xhat, yhat : arrays of modeled data plotted in best-fit line
@@ -111,20 +114,6 @@ def probplot(data, ax=None, plottype='prob', dist=None, probax='x',
111114
... line_kws=dict(linestyle='-', linewidth=2),
112115
... scatter_kws=dict(marker='s', alpha=0.5))
113116
114-
115-
116-
Quantile plot with a custom distribution
117-
118-
.. plot::
119-
:context: close-figs
120-
121-
>>> norm = stats.norm(5, 1.25)
122-
>>> fig = probplot(data, ax=ax, plottype='qq', dist=norm,
123-
... probax='x', problabel='Theoretical Quantiles',
124-
... datalabel='Observed values', bestfit=True,
125-
... line_kws=dict(linestyle=':', linewidth=2),
126-
... scatter_kws=dict(marker='^', alpha=0.5))
127-
128117
"""
129118

130119
if dist is None:
@@ -234,32 +223,32 @@ def plot_pos(data, postype=None, alpha=None, beta=None):
234223
values can also be access via the ``postype`` parameter. Available
235224
``postype`` values (alpha, beta) are:
236225
237-
"type 4" (alpha=0, beta=1)
226+
"type 4" (alpha=0, beta=1)
238227
Linear interpolation of the empirical CDF.
239-
"type 5" or "hazen" (alpha=0.5, beta=0.5)
228+
"type 5" or "hazen" (alpha=0.5, beta=0.5)
240229
Piecewise linear interpolation.
241-
"type 6" or "weibull" (alpha=0, beta=0)
230+
"type 6" or "weibull" (alpha=0, beta=0)
242231
Weibull plotting positions. Unbiased exceedance probability
243232
for all distributions. Recommended for hydrologic
244233
applications.
245-
"type 7" (alpha=1, beta=1)
234+
"type 7" (alpha=1, beta=1)
246235
The default values in R. Not recommended with probability
247236
scales as the min and max data points get plotting positions
248237
of 0 and 1, respectively, and therefore cannot be shown.
249-
"type 8" (alpha=1/3, beta=1/3)
238+
"type 8" (alpha=1/3, beta=1/3)
250239
Approximately median-unbiased.
251-
"type 9" or "blom" (alpha=0.375, beta=0.375)
240+
"type 9" or "blom" (alpha=0.375, beta=0.375)
252241
Approximately unbiased positions if the data are normally
253242
distributed.
254-
"median" (alpha=0.3175, beta=0.3175)
243+
"median" (alpha=0.3175, beta=0.3175)
255244
Median exceedance probabilities for all distributions
256245
(used in ``scipy.stats.probplot``).
257-
"apl" or "pwm" (alpha=0.35, beta=0.35)
246+
"apl" or "pwm" (alpha=0.35, beta=0.35)
258247
Used with probability-weighted moments.
259-
"cunnane" (alpha=0.4, beta=0.4)
248+
"cunnane" (alpha=0.4, beta=0.4)
260249
Nearly unbiased quantiles for normally distributed data.
261250
This is the default value.
262-
"gringorten" (alpha=0.44, beta=0.44)
251+
"gringorten" (alpha=0.44, beta=0.44)
263252
Used for Gumble distributions.
264253
265254
Parameters

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
DESCRIPTION = "mpl-probscale: Probabily scales for matplotlib"
1111
LONG_DESCRIPTION = DESCRIPTION
1212
NAME = "probscale"
13-
VERSION = "0.1.2"
13+
VERSION = "0.2.0"
1414
AUTHOR = "Paul Hobson (Geosyntec Consultants)"
1515
AUTHOR_EMAIL = "[email protected]"
1616
URL = "https://github.com/phobson/mpl-probscale"

0 commit comments

Comments
 (0)