Skip to content

Commit 89bd9ec

Browse files
committed
Major docs cleanup, easier to read
1 parent 6504193 commit 89bd9ec

File tree

13 files changed

+287
-228
lines changed

13 files changed

+287
-228
lines changed

WHATSNEW.rst

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,12 @@ ProPlot v0.7.0 (2021-06-30)
9898

9999
.. rubric:: Features
100100

101-
* Permit different colors for `~matplotlib.axes.Axes.boxplot` and
102-
`~matplotlib.axes.Axes.violinplot` using color lists (:issue:`217`, :pr:`218`)
103-
by `Mickaël Lalande`_.
101+
* Add :rcraw:`basemap` setting for changing the default backend (:commit:`###`). If
102+
users have a cartopy vs. basemap preference, they probably want to use it globally.
103+
* Add :rcraw:`cartopy.circular` setting for optionally disabling the "circular bounds
104+
on polar projections" feature (:commit:`###`).
105+
* Add :rcraw:`abc.pad` and :rcraw:`abc.above` settings for changing a-b-c label
106+
padding separate from titles (:commit:`###`).
104107
* Add `titlebbox` and `abcbbox` as alternatives to `titleborder` and `abcborder`
105108
for "inner" titles and a-b-c labels (:pr:`240`) by `Pratiman Patel`_.
106109
Default behavior uses borders.
@@ -124,6 +127,9 @@ ProPlot v0.7.0 (2021-06-30)
124127
in a `legend_kw` keyword argument (:commit:`a11d1813`).
125128
* Set default transform to ``ccrs.PlateCarree`` when calling `matplotlib.axes.Axes.fill`
126129
on `CartopyAxes` (:issue:`193`). This is more consistent with rest of package.
130+
* Permit different colors for `~matplotlib.axes.Axes.boxplot` and
131+
`~matplotlib.axes.Axes.violinplot` using color lists (:issue:`217`, :pr:`218`)
132+
by `Mickaël Lalande`_.
127133
* Use `Artist` labels for the default colorbar tick labels when making colorbars from
128134
lists of artists if `values` was not passed -- and if labels are non-numeric, rotate
129135
them 90 degrees for horizontal colorbars by default (:commit:`ed8e1314`). Makes

docs/1dplots.py

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,11 @@
1919
# ================
2020
#
2121
# ProPlot adds new features to various `~matplotlib.axes.Axes` plotting
22-
# methods using a set of wrapper functions. When a plotting method like
22+
# methods using a set of "wrapper" functions. When a plotting method like
2323
# `~matplotlib.axes.Axes.plot` is "wrapped" by one of these functions, it
24-
# accepts the same parameters as the wrapper. These features are a strict
25-
# *superset* of the matplotlib API.
24+
# accepts the same parameters as the wrapper. These additions are a strict
25+
# *superset* of matplotlib -- if you are not interested, you
26+
# can use matplotlib's plotting methods just like you always have.
2627
# This section documents the features added by wrapper functions to 1D
2728
# plotting commands like `~matplotlib.axes.Axes.plot`,
2829
# `~matplotlib.axes.Axes.scatter`, `~matplotlib.axes.Axes.bar`, and
@@ -40,11 +41,11 @@
4041
# and use different property cycles for different plot elements. You can create and
4142
# apply property cycles on-the-fly using the `cycle` and `cycle_kw` arguments, available
4243
# with any plotting method wrapped by `~proplot.axes.cycle_changer`. `cycle` and
43-
# `cycle_kw` are passed to the `~proplot.constructor.Cycle` constructor function, and
44-
# the resulting property cycle is used for the plot. You can specify `cycle`
45-
# once with 2D input data (in which case each column is plotted in succession
46-
# according to the property cycle) or call a plotting command multiple times with the
47-
# same `cycle` argument each time (the property cycle is not reset). For more
44+
# `cycle_kw` are passed to the `~proplot.constructor.Cycle` :ref:`constructor function
45+
# <why_constructor>`, and the resulting property cycle is used for the plot. You can
46+
# specify `cycle` once with 2D input data (in which case each column is plotted in
47+
# succession according to the property cycle) or call a plotting command multiple times
48+
# with the same `cycle` argument each time (the property cycle is not reset). For more
4849
# information on property cycles, see the :ref:`color cycles section <ug_cycles>` and
4950
# `this matplotlib tutorial
5051
# <https://matplotlib.org/tutorials/intermediate/color_cycle.html#sphx-glr-tutorials-intermediate-color-cycle-py>`__.
@@ -133,7 +134,8 @@
133134
# configured from the metadata. This restores some of the convenience you get
134135
# with the builtin `pandas <https://pandas.pydata.org>`__ and `xarray
135136
# <https://pandas.pydata.org>`__ plotting functions. This feature is
136-
# *optional*; installation of pandas and xarray are not required.
137+
# *optional*. Installation of pandas and xarray are not required, and
138+
# it can be disabled by setting :rcraw:`autoformat` to ``False``.
137139

138140
# %%
139141
import xarray as xr
@@ -434,7 +436,7 @@
434436
# method. Parametric plots are
435437
# `~matplotlib.collections.LineCollection`\ s that map individual line
436438
# segments to individual colors, where each segment represents a "parametric"
437-
# coordinate (e.g. time). The parametric coordinates are specified with the
439+
# coordinate (e.g., time). The parametric coordinates are specified with the
438440
# `values` keyword argument. See `~proplot.axes.Axes.parametric` for details.
439441
# As shown below, it is also easy to build colorbars from the
440442
# `~matplotlib.collections.LineCollection` returned by
@@ -491,9 +493,9 @@
491493
# `~matplotlib.axes.Axes.scatter` now accepts 2D arrays, just like
492494
# `~matplotlib.axes.Axes.plot`. Also, successive calls to
493495
# `~matplotlib.axes.Axes.scatter` now use the property cycler properties
494-
# (e.g. `color`, `marker`, and `markersize`), and
496+
# (e.g., `color`, `marker`, and `markersize`), and
495497
# `~matplotlib.axes.Axes.scatter` now optionally accepts keywords that look
496-
# like `~matplotlib.axes.Axes.plot` keywords (e.g. `color` instead of `c` and
498+
# like `~matplotlib.axes.Axes.plot` keywords (e.g., `color` instead of `c` and
497499
# `markersize` instead of `s`).
498500
#
499501
# ProPlot also supports property cycling for `~proplot.axes.Axes.step` plots

docs/2dplots.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@
2121
# ProPlot adds new features to various `~matplotlib.axes.Axes` plotting
2222
# methods using a set of wrapper functions. When a plotting method like
2323
# `~matplotlib.axes.Axes.contourf` is "wrapped" by one of these functions, it
24-
# accepts the same parameters as the wrapper. These features are a strict
25-
# *superset* of the matplotlib API.
24+
# accepts the same parameters as the wrapper. These additions are a strict
25+
# *superset* of matplotlib -- if you are not interested, you
26+
# can use matplotlib's plotting methods just like you always have.
2627
# This section documents the features added by wrapper functions to 2D
2728
# plotting commands like `~matplotlib.axes.Axes.contour`,
2829
# `~matplotlib.axes.Axes.contourf`, `~matplotlib.axes.Axes.pcolor`, and
@@ -36,7 +37,8 @@
3637
# -------------------------
3738
#
3839
# It is often useful to create ProPlot colormaps on-the-fly, without
39-
# explicitly calling the `~proplot.constructor.Colormap` constructor function.
40+
# explicitly calling the `~proplot.constructor.Colormap`
41+
# :ref:`constructor function <why_constructor>`.
4042
# You can do so using the `cmap` and `cmap_kw` arguments, available with any
4143
# plotting method wrapped by `~proplot.axes.cmap_changer`. `cmap` and `cmap_kw`
4244
# are passed to `~proplot.constructor.Colormap` and the resulting colormap is
@@ -45,11 +47,10 @@
4547
#
4648
# The `~proplot.axes.cmap_changer` wrapper also
4749
# adds the `norm` and `norm_kw` arguments. They are passed to the
48-
# `~proplot.constructor.Norm` constructor function, and the resulting
49-
# normalizer is used for the plot. For more information on colormaps
50-
# and normalizers, see the :ref:`colormaps section <ug_cmaps>` and `this
51-
# matplotlib tutorial
52-
# <https://matplotlib.org/tutorials/colors/colormapnorms.html>`__.
50+
# `~proplot.constructor.Norm` :ref:`constructor function <why_constructor>`,
51+
# and the resulting normalizer is used for the plot. For more information on colormaps
52+
# and normalizers, see the :ref:`colormaps section <ug_cmaps>` and `this matplotlib
53+
# tutorial <https://matplotlib.org/tutorials/colors/colormapnorms.html>`__.
5354

5455
# %%
5556
import proplot as plot
@@ -271,8 +272,8 @@
271272
# label, and/or title are configured from the metadata. This restores some of
272273
# the convenience you get with the builtin `pandas
273274
# <https://pandas.pydata.org>`__ and `xarray <https://pandas.pydata.org>`__
274-
# plotting functions. This feature is *optional*; installation of pandas and
275-
# xarray are not required.
275+
# plotting functions. This feature is *optional*. Installation of pandas and xarray are
276+
# not required, and it can be disabled by setting :rcraw:`autoformat` to ``False``.
276277

277278
# %%
278279
import xarray as xr

docs/axis.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@
3737
# using the `~proplot.axes.Axes.format` keyword arguments `xlocator`,
3838
# `ylocator`, `xminorlocator`, and `yminorlocator` (or their aliases,
3939
# `xticks`, `yticks`, `xminorticks`, and `yminorticks`). This is powered by
40-
# the `~proplot.constructor.Locator` constructor function.
40+
# the `~proplot.constructor.Locator` :ref:`constructor function <why_constructor>`.
4141
#
4242
# These keyword arguments can be used to apply built-in matplotlib
4343
# `~matplotlib.ticker.Locator`\ s by their "registered" names (e.g.
4444
# ``xlocator='log'``), to draw ticks every ``N`` data values with
45-
# `~matplotlib.ticker.MultipleLocator` (e.g. ``xlocator=2``), or to tick the
45+
# `~matplotlib.ticker.MultipleLocator` (e.g., ``xlocator=2``), or to tick the
4646
# specific locations in a list using `~matplotlib.ticker.FixedLocator` (just
4747
# like `~matplotlib.axes.Axes.set_xticks` and
4848
# `~matplotlib.axes.Axes.set_yticks`). See
@@ -131,12 +131,13 @@
131131
# nicely-formatted tick labels. In ProPlot, you can change the tick formatter
132132
# using the `~proplot.axes.Axes.format` keyword arguments `xformatter` and
133133
# `yformatter` (or their aliases, `xticklabels` and `yticklabels`). This is
134-
# powered by the `~proplot.constructor.Formatter` constructor function.
134+
# powered by the `~proplot.constructor.Formatter`
135+
# :ref:`constructor function <why_constructor>`.
135136
#
136137
# These keyword arguments can be used to apply built-in matplotlib
137138
# `~matplotlib.ticker.Formatter`\ s by their "registered" names (e.g.
138139
# ``xformatter='log'``), to apply a ``%``-style format directive with
139-
# `~matplotlib.ticker.FormatStrFormatter` (e.g. ``xformatter='%.0f'``), or
140+
# `~matplotlib.ticker.FormatStrFormatter` (e.g., ``xformatter='%.0f'``), or
140141
# to apply custom tick labels with `~matplotlib.ticker.FixedFormatter` (just
141142
# like `~matplotlib.axes.Axes.set_xticklabels` and
142143
# `~matplotlib.axes.Axes.set_yticklabels`). They can also be used
@@ -246,8 +247,8 @@
246247
#
247248
# ProPlot can also be used to customize the tick locations and tick label
248249
# format of "datetime" axes. To draw ticks on some particular time unit, just
249-
# use a unit string (e.g. ``xlocator='month'``). To draw ticks every ``N``
250-
# time units, just use a (unit, N) tuple (e.g. ``xlocator=('day', 5)``). For
250+
# use a unit string (e.g., ``xlocator='month'``). To draw ticks every ``N``
251+
# time units, just use a (unit, N) tuple (e.g., ``xlocator=('day', 5)``). For
251252
# `% style formatting
252253
# <https://docs.python.org/3/library/datetime.html#strftime-strptime-behavior>`__
253254
# of datetime tick labels, just use a string containing ``'%'`` (e.g.
@@ -313,7 +314,8 @@
313314
# "Axis scales" like ``'linear'`` and ``'log'`` control the *x* and *y* axis
314315
# coordinate system. To change the axis scale, simply pass e.g.
315316
# ``xscale='log'`` or ``yscale='log'`` to `~proplot.axes.Axes.format`. This
316-
# is powered by the `~proplot.constructor.Scale` constructor function.
317+
# is powered by the `~proplot.constructor.Scale`
318+
# :ref:`constructor function <why_constructor>`.
317319
#
318320
# ProPlot also makes several changes to the axis scale API:
319321
#

docs/basics.py

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# extension: .py
66
# format_name: percent
77
# format_version: '1.3'
8-
# jupytext_version: 1.3.0
8+
# jupytext_version: 1.4.2
99
# kernelspec:
1010
# display_name: Python 3
1111
# language: python
@@ -44,7 +44,7 @@
4444
# subplot and ``0`` indicates an empty space.
4545
#
4646
# In the below examples, we create a few simple figures with `~proplot.ui.subplots`.
47-
# See the next sections for details.
47+
# See the :ref:`next sections <ug_format>` for details.
4848

4949
# %% [raw] raw_mimetype="text/restructuredtext"
5050
# .. note::
@@ -53,9 +53,7 @@
5353
# `matplotlib backend <https://matplotlib.org/faq/usage_faq#what-is-a-backend>`__
5454
# -- the default background color is white when the figure is saved. This is done
5555
# by setting :rcraw:`figure.facecolor` to gray, in order to improve contrast
56-
# when working with figures, similar to MATLAB.
57-
#
58-
# ProPlot also changes the default
56+
# when working with figures. ProPlot also changes the default
5957
# :rcraw:`savefig.format` from PNG to PDF for the following reasons:
6058
#
6159
# #. Vector graphic formats are infinitely scalable.
@@ -70,6 +68,15 @@
7068
# as the minimum resolution for rasterized figures containing lines and text.
7169
# See the :ref:`configuration section <ug_proplotrc>` for how to change
7270
# any of these settings.
71+
#
72+
# .. warning::
73+
#
74+
# ProPlot enables "axis sharing" by default. This lets subplots in the same row or
75+
# column share the same axis limits, scales, ticks, and labels. This is often
76+
# convenient, but may be annoying for some users. To keep this feature turned off,
77+
# simply :ref:`change the default settings <ug_rc>` with e.g.
78+
# ``plot.rc.update(share=False, span=False)``. See :ref:`this section <ug_share>`
79+
# for details.
7380

7481
# %%
7582
# Generate sample data
@@ -181,10 +188,13 @@
181188
# ``format`` method. This is your one-stop-shop for changing axes settings.
182189
# Keyword arguments passed to ``format`` are interpreted as follows:
183190
#
191+
# .. rst-class:: dummy-line-break-class
192+
#
184193
# 1. Any keyword matching the name of an `~proplot.config.rc` setting
185194
# is used to update the axes. If the name has "dots", you can omit them
186-
# (e.g. ``titleloc='left'`` to change the :rcraw:`title.loc` property).
195+
# (e.g., ``titleloc='left'`` changes the :rcraw:`title.loc` property).
187196
# See the :ref:`configuration section <ug_config>` for details.
197+
#
188198
# 2. Valid keywords arguments are passed to
189199
# `proplot.axes.CartesianAxes.format`, `proplot.axes.PolarAxes.format`, or
190200
# `proplot.axes.GeoAxes.format`. These change settings that are
@@ -202,14 +212,14 @@
202212
# 3. Remaining keyword arguments are passed to the base `proplot.axes.Axes.format`
203213
# method. `~proplot.axes.Axes` is the base class for all other axes classes.
204214
# This changes things that are the same for all axes types, like titles and
205-
# a-b-c subplot labels (e.g. ``title='Title'``).
215+
# a-b-c subplot labels (e.g., ``title='Title'``).
206216
#
207217
# The ``format`` methods let you use simple shorthands for changing all kinds
208218
# of settings at once, instead of one-liner setter methods like
209219
# ``ax.set_title()`` and ``ax.set_xlabel()``. They are also integrated with
210220
# the `~proplot.constructor.Locator`, `~proplot.constructor.Formatter`,
211-
# and `~proplot.constructor.Scale` constructor functions (see the
212-
# :ref:`Cartesian axis settings <ug_cartesian>` section for details).
221+
# and `~proplot.constructor.Scale` :ref:`constructor functions <why_constructor>`
222+
# (see :ref:`this section <ug_cartesian>` for details).
213223
#
214224
# The below example shows the many different keyword arguments accepted by
215225
# ``format``, and demonstrates how ``format`` can be used to succinctly and
@@ -243,15 +253,15 @@
243253
# %% [raw] raw_mimetype="text/restructuredtext"
244254
# .. _ug_container:
245255
#
246-
# Formatting all-at-once
247-
# ----------------------
256+
# Subplot containers
257+
# ------------------
248258
#
249259
# Instead of an `~numpy.ndarray` of subplots, `~proplot.ui.subplots` returns a
250260
# `~proplot.ui.SubplotsContainer`. This container behaves like an
251261
# `~matplotlib.axes.Axes` object when it contains just one axes, and behaves
252-
# like a list otherwise. It supports both 1D indexing (e.g. ``axs[1]``) and
253-
# 2D indexing (e.g. ``axs[0, 1]``), and is row-major by default. Slicing a
254-
# `~proplot.ui.SubplotsContainer` returns another container (e.g. ``axs[:, 0]``).
262+
# like a list otherwise. It supports both 1D indexing (e.g., ``axs[1]``) and
263+
# 2D indexing (e.g., ``axs[0, 1]``), and is row-major by default. Slicing a
264+
# `~proplot.ui.SubplotsContainer` returns another container (e.g., ``axs[:, 0]``).
255265
#
256266
# `~proplot.ui.SubplotsContainer` is useful because it lets you call
257267
# `~proplot.axes.Axes` methods simultaneously for all subplots in the container.
@@ -281,7 +291,7 @@
281291
# %% [raw] raw_mimetype="text/restructuredtext"
282292
# .. _ug_rc:
283293
#
284-
# Styles and settings
294+
# Settings and styles
285295
# -------------------
286296
#
287297
# A special object named `~proplot.config.rc` is created whenever you import

0 commit comments

Comments
 (0)