Skip to content

Commit 528026a

Browse files
committed
Merge pull request #28 from phobson/new-api-doc
New api doc
2 parents 075c2b0 + 4d382b1 commit 528026a

15 files changed

+261
-70
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@ before_install:
3232
- ./miniconda.sh -b -p $HOME/miniconda
3333
- export PATH="$HOME/miniconda/bin:$PATH"
3434
- conda update --yes conda
35+
- conda install --yes nomkl
3536

3637
install:
3738

3839
# We just set up a conda environment with the right Python version. This
3940
# should not need changing.
4041

41-
- conda create --yes -n test python=$TRAVIS_PYTHON_VERSION
42+
- conda create --yes -n test python=$TRAVIS_PYTHON_VERSION numpy matplotlib docopt requests pyyaml
4243
- source activate test
43-
- conda install --yes --channel=conda-forge numpy matplotlib docopt requests pyyaml
4444
- conda install --yes --channel=${TESTERS}
4545
- if [ ${COVERAGE} = true ]; then conda install scipy --yes; fi
4646
- pip install coveralls

docs/api/validate.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.. _validate_auto:
2+
3+
The ``validate`` API
4+
5+
``validate`` API Reference
6+
============================
7+
8+
.. automodule:: probscale.validate
9+
:members:
10+
:undoc-members:
11+
:show-inheritance:

docs/conf.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
import os
1818
import shlex
1919

20+
import seaborn
21+
clear_bkgd = {'axes.facecolor':'none', 'figure.facecolor':'none'}
22+
seaborn.set(style='ticks', context='talk', color_codes=True, rc=clear_bkgd)
2023

2124
# If extensions (or modules to document with autodoc) are in another directory,
2225
# add these directories to sys.path here. If the directory is relative to the
@@ -60,6 +63,12 @@
6063
# source_suffix = ['.rst', '.md']
6164
source_suffix = '.rst'
6265

66+
# Include the example source for plots in API docs
67+
plot_include_source = True
68+
plot_formats = [("png", 150)]
69+
plot_html_show_formats = False
70+
plot_html_show_source_link = False
71+
6372
# The encoding of source files.
6473
#source_encoding = 'utf-8-sig'
6574

probscale/formatters.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,17 @@ class PctFormatter(_FormatterMixin):
9494
"""
9595
Formatter class for MPL axes to display probalities as percentages.
9696
97+
Examples
98+
--------
99+
>>> from probscale import formatters
100+
>>> fmt = formatters.PctFormatter()
101+
>>> fmt(0.2)
102+
'0.2'
103+
>>> fmt(10)
104+
'10'
105+
>>> fmt(99.999)
106+
'99.999'
107+
97108
"""
98109

99110
factor = 1.0
@@ -105,6 +116,19 @@ class ProbFormatter(_FormatterMixin):
105116
"""
106117
Formatter class for MPL axes to display probalities as decimals.
107118
119+
Examples
120+
--------
121+
>>> from probscale import formatters
122+
>>> fmt = formatters.ProbFormatter()
123+
>>> fmt(0.01)
124+
'0,01'
125+
>>> fmt(0.2)
126+
'0.20'
127+
>>> try:
128+
... fmt(10.5)
129+
... except(ValueError):
130+
... print('formatter out of bounds')
131+
formatter out of bounds
108132
"""
109133

110134
factor = 100.0

probscale/probscale.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ class ProbScale(ScaleBase):
8585
>>> from matplotlib import pyplot
8686
>>> import probscale
8787
>>> fig, ax = pyplot.subplots()
88-
>>> ax.set_xlim(left=0.2, right=99.9)
89-
>>> ax.set_xscale('prob')
88+
>>> ax.set_ylim(bottom=0.2, top=99.9)
89+
>>> ax.set_yscale('prob')
9090
9191
"""
9292

Loading
Loading
Loading
Loading

probscale/tests/test_probscale.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
try:
88
from scipy import stats
9-
except:
9+
except: # pragma: no cover
1010
stats = None
1111

1212
import pytest

0 commit comments

Comments
 (0)