Skip to content

Commit 492d7de

Browse files
committed
Clean up docs
1 parent 4288a73 commit 492d7de

File tree

7 files changed

+110
-111
lines changed

7 files changed

+110
-111
lines changed

WHATSNEW.rst

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -348,38 +348,39 @@ ProPlot v0.6.0 (2020-05-20)
348348
* Drop support for ``.rgba`` files, but optionally read 4th opacity column
349349
from ``.rgb`` and ``.txt`` files (:commit:`4fa72b0c`).
350350
* Stop reversing the ``'Spectral'`` colormap when ProPlot is imported
351-
(:commit:`ce4ef6a0`).
352-
* Remove ``'Blue0'`` SciVisColor colormap (:commit:`7cb4ce0f`). It was odd man
353-
out in the table, and not even really perceptually uniform.
351+
(:pr:`149`, :commit:`ce4ef6a0`).
352+
* Remove ``'Blue0'`` SciVisColor colormap (:pr:`149`, :commit:`7cb4ce0f`). It was odd
353+
man out in the table, and not even really perceptually uniform.
354354
* Remove custom ProPlot cycles -- these should be thought out much more
355355
carefully (:commit:`43f65d17`).
356-
* Remove "crayola" colors and clean up the `~proplot.setup.register_colors`
357-
algorithm (:commit:`8922d6de`). Crayola color names less intuitive than XKCD.
356+
* Remove "crayola" colors and clean up the `~proplot.setup.register_colors` algorithm
357+
(:pr:`149`, :commit:`8922d6de`). Crayola color names less intuitive than XKCD.
358358
* Use ``'cmap_s'`` instead of ``'cmap_shifted'`` to quickly get a 180
359-
degree-shifted colormap, similar to ``'cmap_r'`` (:commit:`da4ccb08`).
359+
degree-shifted colormap, similar to ``'cmap_r'`` (:pr:`149`, :commit:`da4ccb08`).
360360
* Rename ``GrayCycle`` colormap to ``MonoCycle`` to more accurately reflect
361-
colormap design origins (:commit:`d67e45bf`).
362-
* Rename `~proplot.config.rc_configurator` to `~proplot.config.RcConfigurator`
363-
to match capitalized class naming convention.
361+
colormap design origins (:pr:`149`, :commit:`d67e45bf`).
362+
* Rename `~proplot.config.rc_configurator` and `~proplot.ui.subplot_grid` to
363+
`~proplot.config.RcConfigurator` and `~proplot.ui.SubplotsContainer`
364+
to match capitalized class naming convention (:pr:`149`).
364365
* Rename `~proplot.colors.MidpointNorm` to more intuitive
365366
`~proplot.colors.DivergingNorm`, and make "fair" color scaling the default
366367
behavior (:commit:`2f549c9`).
367368
* Rename `XYAxes` to `~proplot.axes.CartesianAxes`, `~proplot.axes.GeoAxes`
368369
to `~proplot.axes.CartopyAxes`, and `~proplot.axes.ProjAxes` to
369-
`~proplot.axes.GeoAxes` (:commit:`4a6a0e34`).
370+
`~proplot.axes.GeoAxes` (:pr:`149`, :commit:`4a6a0e34`).
370371
* Rename `BinNorm` to `~proplot.styletools.DiscreteNorm`
371-
and fix issues with diverging norm color scaling (:commit:`98a976f1`).
372+
and fix issues with diverging norm color scaling (:pr:`149`, :commit:`98a976f1`).
372373
* Rename `ColorDict` to `~proplot.colors.ColorDatabase`, `CmapDict`
373-
to `~proplot.colors.ColormapDatabase` (:commit:`9d7fd3e0`).
374+
to `~proplot.colors.ColormapDatabase` (:pr:`149`, :commit:`9d7fd3e0`).
374375
* Rename `~proplot.styletools.LinearSegmentedColormap.concatenate` to
375376
`~proplot.styletools.LinearSegmentedColormap.append`,
376377
`~proplot.styletools.LinearSegmentedColormap.updated` to
377378
`~proplot.styletools.LinearSegmentedColormap.copy`,
378379
`~proplot.styletools.LinearSegmentedColormap.truncated` to
379380
`~proplot.styletools.LinearSegmentedColormap.truncate`, and
380381
`~proplot.styletools.LinearSegmentedColormap.punched` to
381-
`~proplot.styletools.LinearSegmentedColormap.cut` (:commit:`e1a08930`). The old
382-
method names remain with a deprecation warning.
382+
`~proplot.styletools.LinearSegmentedColormap.cut` (:pr:`149`, :commit:`e1a08930`).
383+
The old method names remain with a deprecation warning.
383384

384385
.. rubric:: Features
385386

docs/1dplots.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -525,8 +525,8 @@
525525
data = state.rand(2, 100)
526526
obj = ax.scatter(
527527
*data, color=data.sum(axis=0), size=state.rand(100), smin=3, smax=30,
528-
marker='o', cmap='dark red', colorbar='lr', vmin=0, vmax=2,
529-
colorbar_kw={'label': 'label', 'locator': 0.5}
528+
marker='o', cmap='dark red', cmap_kw={'fade': 90}, vmin=0, vmax=2,
529+
colorbar='lr', colorbar_kw={'label': 'label', 'locator': 0.5},
530530
)
531531
axs.format(xlabel='xlabel', ylabel='ylabel')
532532

docs/2dplots.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
# are passed to `~proplot.constructor.Colormap` and the resulting colormap is
4343
# used for the plot. For example, to create and apply a monochromatic colormap,
4444
# you can simply use ``cmap='color name'``.
45-
45+
#
4646
# The `~proplot.axes.cmap_changer` wrapper also
4747
# adds the `norm` and `norm_kw` arguments. They are passed to the
4848
# `~proplot.constructor.Norm` constructor function, and the resulting

docs/basics.py

Lines changed: 62 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,12 @@
2828
# ProPlot works by creating a `proplot.figure.Figure` subclass of the
2929
# matplotlib figure class `~matplotlib.figure.Figure`, and a `proplot.axes.Axes`
3030
# subclass of the matplotlib axes class `~matplotlib.axes.Axes`.
31-
# All plotting in ProPlot begins by generating
32-
# an instance of the new figure class filled with instances of the new
33-
# axes classes using the `~proplot.ui.subplots` command, which is modeled
34-
# after `matplotlib.pyplot.subplots`.
35-
# ProPlot's `~proplot.ui.subplots` command can be used as follows:
3631
#
37-
# * Without any arguments, `~proplot.ui.subplots` returns a figure with a
32+
# The `~proplot.ui.subplots` command is used to create ProPlot figures. Modeled after
33+
# `matplotlib.pyplot.subplots`, it generates a `proplot.figure.Figure` instance filled
34+
# with `proplot.axes.Axes` instances. `~proplot.ui.subplots` can be used as follows:
35+
#
36+
# * With no arguments, `~proplot.ui.subplots` returns a figure with a
3837
# single subplot.
3938
# * With `ncols` or `nrows`, `~proplot.ui.subplots` returns a
4039
# figure with a simple grid of subplots.
@@ -44,9 +43,8 @@
4443
# `~matplotlib.gridspec.GridSpec` slot that is occupied by the corresponding
4544
# subplot and ``0`` indicates an empty space.
4645
#
47-
# In the below examples, we create subplot grids with `~proplot.ui.subplots`
48-
# and modify the axes labels. See the :ref:`formatting guide <ug_format>`
49-
# and :ref:`subplots container <ug_container>` sections for details.
46+
# In the below examples, we create a few simple figures with `~proplot.ui.subplots`.
47+
# See the next sections for details.
5048

5149
# %% [raw] raw_mimetype="text/restructuredtext"
5250
# .. note::
@@ -55,7 +53,9 @@
5553
# `matplotlib backend <https://matplotlib.org/faq/usage_faq#what-is-a-backend>`__
5654
# -- the default background color is white when the figure is saved. This is done
5755
# by setting :rcraw:`figure.facecolor` to gray, in order to improve contrast
58-
# when working with figures, similar to MATLAB. ProPlot also changes the default
56+
# when working with figures, similar to MATLAB.
57+
#
58+
# ProPlot also changes the default
5959
# :rcraw:`savefig.format` from PNG to PDF for the following reasons:
6060
#
6161
# #. Vector graphic formats are infinitely scalable.
@@ -132,26 +132,24 @@
132132
# %% [raw] raw_mimetype="text/restructuredtext"
133133
# .. _ug_plots:
134134
#
135-
# Plotting data
136-
# -------------
135+
# Plotting stuff
136+
# --------------
137137
#
138138
# Matplotlib has
139-
# `two different APIs <https://matplotlib.org/3.2.1/api/index.html>`__:
140-
# an object-oriented API and a MATLAB-style
141-
# `~matplotlib.pyplot` API (which uses the object-oriented API internally).
142-
# Plotting in ProPlot is just like plotting in matplotlib with
143-
# the *object-oriented* API. Rather than creating
144-
# a brand new interface, ProPlot simply builds upon the existing matplotlib
145-
# constructs of the `~matplotlib.axes.Axes` and the `~matplotlib.figure.Figure`
146-
# by adding new commands and new options to existing commands, without changing
147-
# the usage or syntax. This means a shallow learning curve for the average
148-
# matplotlib user.
139+
# `two different interfaces <https://matplotlib.org/3.2.1/api/index.html>`__:
140+
# an object-oriented interface and a MATLAB-style `~matplotlib.pyplot` interface
141+
# (which uses the object-oriented interface internally). Plotting with ProPlot is
142+
# just like plotting with matplotlib's *object-oriented* interface. Proplot builds
143+
# upon the matplotlib constructs of the `~matplotlib.figure.Figure` and the
144+
# `~matplotlib.axes.Axes` by adding new commands and adding new features to
145+
# existing commands. These additions do not change the usage or syntax of existing
146+
# commands, which means a shallow learning curve for the average matplotlib user.
149147
#
150148
# In the below example, we create a 4-panel figure with the familiar matplotlib
151149
# commands `~matplotlib.axes.Axes.plot`, `~matplotlib.axes.Axes.scatter`,
152150
# `~matplotlib.axes.Axes.pcolormesh`, and `~matplotlib.axes.Axes.contourf`.
153151
# See the :ref:`1d plotting <ug_1dplots>` and :ref:`2d plotting <ug_2dplots>`
154-
# sections for details on the plotting features added by ProPlot.
152+
# sections for details on the features added by ProPlot.
155153

156154

157155
# %%
@@ -176,7 +174,7 @@
176174
# %% [raw] raw_mimetype="text/restructuredtext"
177175
# .. _ug_format:
178176
#
179-
# Formatting plots
177+
# Formatting stuff
180178
# ----------------
181179
#
182180
# Every `~matplotlib.axes.Axes` returned by `~proplot.ui.subplots` has a
@@ -191,7 +189,7 @@
191189
# `proplot.axes.CartesianAxes.format`, `proplot.axes.PolarAxes.format`, or
192190
# `proplot.axes.GeoAxes.format`. These change settings that are
193191
# specific to the axes type. For example:
194-
192+
#
195193
# * To change the *x* axis bounds on a `~proplot.axes.CartesianAxes`,
196194
# use e.g. ``xlim=(0, 5)``.
197195
# * To change the radial bounds on a `~proplot.axes.PolarAxes`, use e.g.
@@ -242,12 +240,49 @@
242240
xtickdir='inout', xtickminor=False, ygridminor=True,
243241
)
244242

243+
# %% [raw] raw_mimetype="text/restructuredtext"
244+
# .. _ug_container:
245+
#
246+
# Formatting all-at-once
247+
# ----------------------
248+
#
249+
# Instead of an `~numpy.ndarray` of subplots, `~proplot.ui.subplots` returns a
250+
# `~proplot.ui.SubplotsContainer`. This container behaves like an
251+
# `~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]``).
255+
#
256+
# `~proplot.ui.SubplotsContainer` is useful because it lets you call
257+
# `~proplot.axes.Axes` methods simultaneously for all subplots in the container.
258+
# In the below example, we use the `~proplot.ui.SubplotsContainer` returned by
259+
# `~proplot.ui.subplots` with the `proplot.axes.Axes.format` command to format
260+
# several subplots at once.
261+
262+
# %%
263+
import proplot as plot
264+
import numpy as np
265+
state = np.random.RandomState(51423)
266+
fig, axs = plot.subplots(ncols=4, nrows=4, axwidth=1.2)
267+
axs.format(
268+
xlabel='xlabel', ylabel='ylabel', suptitle='SubplotsContainer demo',
269+
grid=False, xlim=(0, 50), ylim=(-4, 4)
270+
)
271+
272+
# Various ways to select subplots in the container
273+
axs[:, 0].format(facecolor='blush', color='gray7', linewidth=1)
274+
axs[0, :].format(facecolor='sky blue', color='gray7', linewidth=1)
275+
axs[0].format(color='black', facecolor='gray5', linewidth=1.4)
276+
axs[1:, 1:].format(facecolor='gray1')
277+
for ax in axs[1:, 1:]:
278+
ax.plot((state.rand(50, 5) - 0.5).cumsum(axis=0), cycle='Grays', lw=2)
279+
245280

246281
# %% [raw] raw_mimetype="text/restructuredtext"
247282
# .. _ug_rc:
248283
#
249-
# Changing rc settings
250-
# --------------------
284+
# Styles and settings
285+
# -------------------
251286
#
252287
# A special object named `~proplot.config.rc` is created whenever you import
253288
# ProPlot. `~proplot.config.rc` is similar to the matplotlib
@@ -326,41 +361,3 @@
326361
for ax, style in zip(axs, styles):
327362
ax.format(style=style, xlabel='xlabel', ylabel='ylabel', title=style)
328363
ax.plot(data, linewidth=3)
329-
330-
331-
# %% [raw] raw_mimetype="text/restructuredtext"
332-
# .. _ug_container:
333-
#
334-
# Subplots containers
335-
# -------------------
336-
#
337-
# Instead of an `~numpy.ndarray` of axes, `~proplot.ui.subplots` returns a
338-
# `~proplot.ui.SubplotsContainer` instance. This container behaves like an
339-
# `~matplotlib.axes.Axes` object when it contains just one axes, and behaves
340-
# like a list otherwise. It supports both 1D indexing (e.g. ``axs[1]``) and
341-
# 2D indexing (e.g. ``axs[0, 1]``), and is row-major by default. Slicing a
342-
# `~proplot.ui.SubplotsContainer` returns another container (e.g. ``axs[:, 0]``),
343-
# and `~proplot.axes.Axes` methods can be called simultaneously for all axes in the
344-
# container by calling the method from the container (e.g. ``axs.format(abc=True)``).
345-
#
346-
# In the below example, the `~proplot.ui.SubplotsContainer` returned by
347-
# `~proplot.ui.subplots` is used to cusomtize several axes at once with
348-
# `proplot.axes.Axes.format`.
349-
350-
# %%
351-
import proplot as plot
352-
import numpy as np
353-
state = np.random.RandomState(51423)
354-
fig, axs = plot.subplots(ncols=4, nrows=4, axwidth=1.2)
355-
axs.format(
356-
xlabel='xlabel', ylabel='ylabel', suptitle='SubplotsContainer demo',
357-
grid=False, xlim=(0, 50), ylim=(-4, 4)
358-
)
359-
360-
# Various ways to select subplots in the container
361-
axs[:, 0].format(facecolor='blush', color='gray7', linewidth=1)
362-
axs[0, :].format(facecolor='sky blue', color='gray7', linewidth=1)
363-
axs[0].format(color='black', facecolor='gray5', linewidth=1.4)
364-
axs[1:, 1:].format(facecolor='gray1')
365-
for ax in axs[1:, 1:]:
366-
ax.plot((state.rand(50, 5) - 0.5).cumsum(axis=0), cycle='Grays', lw=2)

docs/configuration.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ to the `~proplot.axes.Axes.format` command:
3434
ax.format(rc_kw={'name1': value1, 'name2': value2})
3535
3636
To temporarily modify settings for particular figure(s), pass the setting
37-
to the `~proplot.config.rc_configurator.context` command:
37+
to the `~proplot.config.RcConfigurator.context` command:
3838

3939
.. code-block:: python
4040

docs/projections.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# extension: .py
77
# format_name: percent
88
# format_version: '1.3'
9-
# jupytext_version: 1.4.2
9+
# jupytext_version: 1.3.0
1010
# kernelspec:
1111
# display_name: Python 3
1212
# language: python
@@ -16,9 +16,9 @@
1616
# %% [raw] raw_mimetype="text/restructuredtext"
1717
#
1818
# .. _polar: https://matplotlib.org/3.1.0/gallery/pie_and_polar_charts/polar_demo.html
19-
19+
#
2020
# .. _cartopy: https://scitools.org.uk/cartopy/docs/latest/
21-
21+
#
2222
# .. _basemap: https://matplotlib.org/basemap/index.html
2323
#
2424
# .. _ug_proj:
@@ -206,8 +206,8 @@
206206
# %% [raw] raw_mimetype="text/restructuredtext"
207207
# .. _ug_geoplot:
208208
#
209-
# Plotting geographic data
210-
# ------------------------
209+
# Geographic plotting
210+
# -------------------
211211
#
212212
# In ProPlot, plotting in `~proplot.axes.GeoAxes` is not much different from
213213
# plotting in `~proplot.axes.CartesianAxes`. ProPlot makes longitude-latitude

0 commit comments

Comments
 (0)