Skip to content

Commit

Permalink
Merge pull request #49 from phobson/cleanup-tutorial-figs
Browse files Browse the repository at this point in the history
Cleanup tutorial figs
  • Loading branch information
phobson authored Feb 9, 2017
2 parents 18e59b3 + 316dce9 commit 5ebf75c
Show file tree
Hide file tree
Showing 7 changed files with 75 additions and 99 deletions.
12 changes: 6 additions & 6 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
mpl-probscale: Real probability scales for matplotlib
=====================================================

.. image:: https://travis-ci.org/phobson/watershed.svg?branch=master
:target: https://travis-ci.org/phobson/watershed
.. image:: https://travis-ci.org/matplotlib/mpl-probscale.svg?branch=master
:target: https://travis-ci.org/matplotlib/mpl-probscale

.. image:: https://coveralls.io/repos/phobson/mpl-probscale/badge.svg?branch=master&service=github
:target: https://coveralls.io/github/phobson/mpl-probscale?branch=master
.. image:: https://coveralls.io/repos/matplotlib/mpl-probscale/badge.svg?branch=master&service=github
:target: https://coveralls.io/github/matplotlib/mpl-probscale?branch=master

https://github.com/phobson/mpl-probscale
https://github.com/matplotlib/mpl-probscale

Installation
------------
Expand All @@ -34,7 +34,7 @@ Development builds

Development builds are available through my conda channel:

``conda install mpl-probscale --channel=phobson``
``conda install mpl-probscale --channel=conda-forge``


Quickstart
Expand Down
8 changes: 4 additions & 4 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ You can either clone the public repository:

.. code-block:: console
$ git clone git://github.com/phobson/probscale
$ git clone git://github.com/matplotlib/mpl-probscale
Or download the `tarball`_:

.. code-block:: console
$ curl -OL https://github.com/phobson/probscale/tarball/master
$ curl -OL https://github.com/matplotlib/mpl-probscale/tarball/master
Once you have a copy of the source, you can install it with:

Expand All @@ -47,5 +47,5 @@ Once you have a copy of the source, you can install it with:
$ pip install .
.. _Github repo: https://github.com/phobson/probscale
.. _tarball: https://github.com/phobson/probscale/tarball/master
.. _Github repo: https://github.com/matplotlib/mpl-probscale
.. _tarball: https://github.com/matplotlib/mpl-probscale/tarball/master
10 changes: 5 additions & 5 deletions docs/tutorial/closer_look_at_plot_pos.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@
},
"outputs": [],
"source": [
"w_opts = {'label': 'Weibull (a=0, b=0)', 'marker': 'o', 'markeredgecolor': 'b'}\n",
"c_opts = {'label': 'Cunnane (a=0.4, b=0.4)', 'marker': 's', 'markeredgecolor': 'g'}\n",
"w_opts = {'label': 'Weibull (α=0, β=0)', 'marker': 'o', 'markeredgecolor': 'b'}\n",
"c_opts = {'label': 'Cunnane (α=0.4, β=0.4)', 'marker': 's', 'markeredgecolor': 'g'}\n",
"\n",
"common_opts = {\n",
" 'markerfacecolor': 'none',\n",
Expand Down Expand Up @@ -198,7 +198,7 @@
},
"outputs": [],
"source": [
"h_opts = {'label': 'Hazen (a=0.5, b=0.5)', 'marker': '^', 'markeredgecolor': 'r'}\n",
"h_opts = {'label': 'Hazen (α=0.5, β=0.5)', 'marker': '^', 'markeredgecolor': 'r'}\n",
"fig, (ax1, ax2) = pyplot.subplots(figsize=(10, 8), ncols=2, sharex=True, sharey=False)\n",
"\n",
"for dist, ax in zip([None, weibull], [ax1, ax2]):\n",
Expand Down Expand Up @@ -280,9 +280,9 @@
"metadata": {
"anaconda-cloud": {},
"kernelspec": {
"display_name": "probscale",
"display_name": "Python [default]",
"language": "python",
"name": "probscale"
"name": "python3"
},
"language_info": {
"codemirror_mode": {
Expand Down
76 changes: 40 additions & 36 deletions docs/tutorial/closer_look_at_viz.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
"ax.set_xlabel('Percentile')\n",
"ax.set_ylabel('Total Bill (USD)')\n",
"ax.set_yscale('log')\n",
"ax.legend(loc='upper left')\n",
"ax.set_ylim(bottom=1, top=100)\n",
"seaborn.despine()"
]
},
Expand All @@ -113,6 +113,7 @@
"fig = probscale.probplot(tips['total_bill'], ax=ax, plottype='pp', datascale='log',\n",
" problabel='Percentile', datalabel='Total Bill (USD)',\n",
" scatter_kws=dict(marker='.', linestyle='none', label='Bill Amount'))\n",
"ax.set_ylim(bottom=1, top=100)\n",
"seaborn.despine()"
]
},
Expand Down Expand Up @@ -148,7 +149,7 @@
"ax.set_xlabel('Normal Quantiles')\n",
"ax.set_ylabel('Total Bill (USD)')\n",
"ax.set_yscale('log')\n",
"ax.legend(loc='upper left')\n",
"ax.set_ylim(bottom=1, top=100)\n",
"seaborn.despine()"
]
},
Expand All @@ -169,9 +170,10 @@
"source": [
"fig, ax = pyplot.subplots(figsize=(6, 3))\n",
"fig = probscale.probplot(tips['total_bill'], ax=ax, plottype='qq', datascale='log', \n",
" problabel='Normal Quantiles', datalabel='Total Bill (USD)',\n",
" problabel='Standard Normal Quantiles', datalabel='Total Bill (USD)',\n",
" scatter_kws=dict(marker='.', linestyle='none', label='Bill Amount'))\n",
"ax.legend(loc='upper left')\n",
"\n",
"ax.set_ylim(bottom=1, top=100)\n",
"seaborn.despine()"
]
},
Expand All @@ -194,15 +196,17 @@
"outputs": [],
"source": [
"fig, (ax1, ax2) = pyplot.subplots(figsize=(6, 6), ncols=2, sharex=True)\n",
"markers = dict(marker='.', linestyle='none', label='Bill Amount')\n",
"\n",
"fig = probscale.probplot(tips['total_bill'], ax=ax1, plottype='pp', probax='y',\n",
" datascale='log', problabel='Percentile', datalabel='Total Bill (USD)',\n",
" scatter_kws=dict(marker='.', linestyle='none', label='Bill Amount'))\n",
" datascale='log', problabel='Percentiles',\n",
" datalabel='Total Bill (USD)', scatter_kws=markers)\n",
"\n",
"fig = probscale.probplot(tips['total_bill'], ax=ax2, plottype='qq', probax='y',\n",
" datascale='log', problabel='Normal Quantiles', datalabel='Total Bill (USD)',\n",
" scatter_kws=dict(marker='.', linestyle='none', label='Bill Amount'))\n",
"ax.legend(loc='upper left')\n",
" datascale='log', problabel='Standard Normal Quantiles',\n",
" datalabel='Total Bill (USD)', scatter_kws=markers)\n",
"\n",
"ax1.set_xlim(left=1, right=100)\n",
"fig.tight_layout()\n",
"seaborn.despine()"
]
Expand Down Expand Up @@ -239,20 +243,16 @@
" scatter_kws=dict(marker='.', linestyle='none')\n",
")\n",
"\n",
"fig = probscale.probplot(tips['total_bill'], ax=ax1, \n",
" plottype='pp',\n",
" problabel='percentile', \n",
" **common_opts)\n",
"fig = probscale.probplot(tips['total_bill'], ax=ax1, plottype='pp',\n",
" problabel='Percentiles', **common_opts)\n",
"\n",
"fig = probscale.probplot(tips['total_bill'], ax=ax2, \n",
" plottype='qq',\n",
" problabel='Normal Quantiles', \n",
" **common_opts)\n",
"fig = probscale.probplot(tips['total_bill'], ax=ax2, plottype='qq',\n",
" problabel='Standard Normal Quantiles', **common_opts)\n",
"\n",
"fig = probscale.probplot(tips['total_bill'], ax=ax3, \n",
" plottype='prob',\n",
" problabel='Normal Probabilities', \n",
" **common_opts)\n",
"fig = probscale.probplot(tips['total_bill'], ax=ax3, plottype='prob',\n",
" problabel='Standard Normal Probabilities', **common_opts)\n",
"\n",
"ax3.set_xlim(left=1, right=100)\n",
"ax3.set_ylim(bottom=0.13, top=99.87)\n",
"fig.tight_layout()\n",
"seaborn.despine()"
Expand Down Expand Up @@ -291,17 +291,19 @@
"alpha = stats.alpha(10)\n",
"beta = stats.beta(6, 3)\n",
"\n",
"fig, (ax1, ax2, ax3) = pyplot.subplots(figsize=(9, 6), ncols=3, sharey=True)\n",
"fig, (ax1, ax2, ax3) = pyplot.subplots(figsize=(9, 6), ncols=3, sharex=True)\n",
"fig = probscale.probplot(tips['total_bill'], ax=ax1, dist=alpha, \n",
" problabel='Alpha Probabilities', **common_opts)\n",
" problabel='Alpha(10) Probabilities', **common_opts)\n",
"\n",
"fig = probscale.probplot(tips['total_bill'], ax=ax2, dist=beta, \n",
" problabel='Beta Probabilities', **common_opts)\n",
" problabel='Beta(6, 1) Probabilities', **common_opts)\n",
"\n",
"fig = probscale.probplot(tips['total_bill'], ax=ax3, dist=None,\n",
" problabel='Normal Probabilities', **common_opts)\n",
" problabel='Standard Normal Probabilities', **common_opts)\n",
"\n",
"ax3.set_ylim(bottom=0.2, top=99.8)\n",
"ax3.set_xlim(left=1, right=100)\n",
"for ax in [ax1, ax2, ax3]:\n",
" ax.set_ylim(bottom=0.2, top=99.8)\n",
"seaborn.despine()\n",
"fig.tight_layout()"
]
Expand Down Expand Up @@ -332,18 +334,17 @@
"alpha = stats.alpha(10)\n",
"beta = stats.beta(6, 3)\n",
"\n",
"fig, (ax1, ax2, ax3) = pyplot.subplots(figsize=(9, 6), ncols=3)\n",
"fig, (ax1, ax2, ax3) = pyplot.subplots(figsize=(9, 6), ncols=3, sharex=True)\n",
"fig = probscale.probplot(tips['total_bill'], ax=ax1, dist=alpha, \n",
" problabel='Alpha Quantiles', **common_opts)\n",
" problabel='Alpha(10) Quantiles', **common_opts)\n",
"\n",
"fig = probscale.probplot(tips['total_bill'], ax=ax2, dist=beta, \n",
" problabel='Beta Quantiles', **common_opts)\n",
" problabel='Beta(6, 3) Quantiles', **common_opts)\n",
"\n",
"fig = probscale.probplot(tips['total_bill'], ax=ax3, dist=None,\n",
" problabel='Normal Quantiles', **common_opts)\n",
" problabel='Standard Normal Quantiles', **common_opts)\n",
"\n",
"ax.legend(loc='upper left')\n",
"ax.set_ylim(bottom=0.1, top=99.9)\n",
"ax1.set_xlim(left=1, right=100)\n",
"seaborn.despine()\n",
"fig.tight_layout()"
]
Expand Down Expand Up @@ -494,6 +495,7 @@
" line_kws=dict(label='Best-fit line'))\n",
"ax.legend(loc='upper left')\n",
"ax.set_ylim(bottom=0.1, top=99.9)\n",
"ax.set_xlim(left=1, right=100)\n",
"seaborn.despine()"
]
},
Expand Down Expand Up @@ -524,6 +526,7 @@
" scatter_kws={'label': 'Observations'},\n",
" problabel='Probability (%)')\n",
"ax.legend(loc='lower right')\n",
"ax.set_ylim(bottom=-2, top=4)\n",
"seaborn.despine(fig)"
]
},
Expand Down Expand Up @@ -566,7 +569,8 @@
"numpy.random.seed(0)\n",
"x = numpy.random.normal(size=15)\n",
"\n",
"fig, (ax1, ax2, ax3) = pyplot.subplots(figsize=(6, 6), nrows=3, sharex=True)\n",
"fig, (ax1, ax2, ax3) = pyplot.subplots(figsize=(6, 6), nrows=3,\n",
" sharey=True, sharex=True)\n",
"fig = probscale.probplot(x, ax=ax1, problabel='Cunnuane (default) plotting positions',\n",
" **common_opts)\n",
"\n",
Expand Down Expand Up @@ -697,7 +701,7 @@
"outputs": [],
"source": [
"fg = (\n",
" seaborn.FacetGrid(data=tips, hue='sex', row='smoker', col='time', aspect=1.5, margin_titles=True)\n",
" seaborn.FacetGrid(data=tips, hue='sex', row='smoker', col='time', margin_titles=True, size=4)\n",
" .map(probscale.probplot, 'total_bill', probax='y', bestfit=True)\n",
" .set_ylabels('Probability')\n",
" .add_legend()\n",
Expand All @@ -708,9 +712,9 @@
"metadata": {
"anaconda-cloud": {},
"kernelspec": {
"display_name": "probscale",
"display_name": "Python [default]",
"language": "python",
"name": "probscale"
"name": "python3"
},
"language_info": {
"codemirror_mode": {
Expand Down
18 changes: 9 additions & 9 deletions docs/tutorial/getting_started.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"\n",
"## Installation\n",
"\n",
"`mpl-probscale` is developed on Python 3.5. It is also tested on Python 3.4 and even 2.7 (for the time being).\n",
"`mpl-probscale` is developed on Python 3.6. It is also tested on Python 3.4, 3.5, and even 2.7 (for the time being).\n",
"\n",
"### From conda\n",
"Official releases of `mpl-probscale` can be found on conda-forge:\n",
Expand All @@ -17,7 +17,7 @@
"\n",
"Fairly recent builds of the development verions are available on my channel:\n",
"\n",
"`conda install --channel=phobson mpl-probscale`\n",
"`conda install --channel=conda-forge mpl-probscale`\n",
"\n",
"\n",
"### From PyPI\n",
Expand All @@ -27,7 +27,7 @@
"\n",
"### From source\n",
"\n",
"`mpl-probscale` is a pure python package. It should be fairly trivial to install from source on any platform. To do that, download or clone from [github](https://github.com/phobson/mpl-probscale), unzip the archive if necessary then do:\n",
"`mpl-probscale` is a pure python package. It should be fairly trivial to install from source on any platform. To do that, download or clone from [github](https://github.com/matplotlib/mpl-probscale), unzip the archive if necessary then do:\n",
"\n",
"```\n",
"cd mpl-probscale # or wherever the setup.py got placed\n",
Expand Down Expand Up @@ -208,11 +208,11 @@
"\n",
"beta1 = stats.beta(a=3, b=2)\n",
"ax2.set_xscale('prob', dist=beta1)\n",
"ax2.set_xlabel('Beta probability scale (a=3, b=2)')\n",
"ax2.set_xlabel('Beta probability scale (α=3, β=2)')\n",
"\n",
"beta2 = stats.beta(a=2, b=7)\n",
"ax3.set_xscale('prob', dist=beta2)\n",
"ax3.set_xlabel('Beta probability scale (a=2, b=7)')\n",
"ax3.set_xlabel('Beta probability scale (α=2, β=7)')\n",
"\n",
"ax4.set_xticks(ax1.get_xticks()[12:-12])\n",
"ax4.set_xlabel('Linear scale (for reference)')\n",
Expand Down Expand Up @@ -366,22 +366,22 @@
"plot = (\n",
" seaborn.load_dataset(\"tips\")\n",
" .assign(pct=lambda df: 100 * df['tip'] / df['total_bill'])\n",
" .pipe(seaborn.FacetGrid, hue='sex', col='time', row='smoker', margin_titles=True, aspect=1.25, size=4)\n",
" .pipe(seaborn.FacetGrid, hue='sex', col='time', row='smoker', margin_titles=True, aspect=1., size=4)\n",
" .map(probscale.probplot, 'pct', bestfit=True, scatter_kws=dict(alpha=0.75), probax='y')\n",
" .add_legend()\n",
" .set_ylabels('Non-Exceedance Probabilty')\n",
" .set_xlabels('Tips as percent of total bill')\n",
" .set(ylim=(0.5, 99.5))\n",
" .set(ylim=(0.5, 99.5), xlim=(0, 100))\n",
")"
]
}
],
"metadata": {
"anaconda-cloud": {},
"kernelspec": {
"display_name": "probscale",
"display_name": "Python [default]",
"language": "python",
"name": "probscale"
"name": "python3"
},
"language_info": {
"codemirror_mode": {
Expand Down
Loading

0 comments on commit 5ebf75c

Please sign in to comment.