Skip to content

Commit b2376f0

Browse files
committed
Clean up docs
1 parent 0fef320 commit b2376f0

File tree

4 files changed

+46
-44
lines changed

4 files changed

+46
-44
lines changed

docs/api.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -90,21 +90,21 @@ Projection classes
9090
:toctree: api
9191

9292

93-
Axis scales
94-
===========
93+
Locators and formatters
94+
=======================
9595

96-
.. automodule:: proplot.scale
96+
.. automodule:: proplot.ticker
9797

98-
.. automodsumm:: proplot.scale
98+
.. automodsumm:: proplot.ticker
9999
:toctree: api
100100

101101

102-
Locators and formatters
103-
=======================
102+
Axis scales
103+
===========
104104

105-
.. automodule:: proplot.ticker
105+
.. automodule:: proplot.scale
106106

107-
.. automodsumm:: proplot.ticker
107+
.. automodsumm:: proplot.scale
108108
:toctree: api
109109

110110

docs/axis.py

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -423,27 +423,35 @@
423423
# %%
424424
import proplot as pplt
425425
import numpy as np
426+
427+
# Create figure
426428
pplt.rc.reset()
429+
state = np.random.RandomState(51423)
430+
colors = ('coral', 'sky blue')
427431
fig, axs = pplt.subplots(nrows=2, ncols=3, refwidth=1.7, share=0, order='F')
428432
axs.format(
429-
toplabels=('Power scales', 'Exponential scales', 'Cartographic scales'),
433+
toplabels=('Geographic scales', 'Exponential scales', 'Power scales'),
430434
)
431-
x = np.linspace(0, 1, 50)
432-
y = 10 * x
433-
state = np.random.RandomState(51423)
434-
data = state.rand(len(y) - 1, len(x) - 1)
435435

436-
# Power scales
437-
colors = ('coral', 'sky blue')
438-
for ax, power, color in zip(axs[:2], (2, 1 / 4), colors):
439-
ax.pcolormesh(x, y, data, cmap='grays', cmap_kw={'right': 0.8})
440-
ax.plot(x, y, lw=4, color=color)
436+
# Geographic scales
437+
n = 20
438+
x = np.linspace(-180, 180, n)
439+
y1 = np.linspace(-85, 85, n)
440+
y2 = np.linspace(-85, 85, n)
441+
data = state.rand(len(x) - 1, len(y2) - 1)
442+
for ax, scale, color in zip(axs[:2], ('sine', 'mercator'), colors):
443+
ax.plot(x, y1, '-', color=color, lw=4)
444+
ax.pcolormesh(x, y2, data, cmap='grays', cmap_kw={'right': 0.8})
441445
ax.format(
442-
ylim=(0.1, 10), yscale=('power', power),
443-
title=f'$x^{{{power}}}$'
446+
title=scale.title() + ' y-axis', yscale=scale, ytickloc='left',
447+
yformatter='deg', grid=False, ylocator=20,
448+
xscale='linear', xlim=None, ylim=(-85, 85)
444449
)
445450

446451
# Exp scales
452+
x = np.linspace(0, 1, 50)
453+
y = 10 * x
454+
data = state.rand(len(y) - 1, len(x) - 1)
447455
for ax, a, c, color in zip(axs[2:4], (np.e, 2), (0.5, 2), colors):
448456
ax.pcolormesh(x, y, data, cmap='grays', cmap_kw={'right': 0.8})
449457
ax.plot(x, y, lw=4, color=color)
@@ -452,19 +460,13 @@
452460
title=f"${(a, 'e')[a == np.e]}^{{{(c, '')[c == 1]}x}}$"
453461
)
454462

455-
# Geographic scales
456-
n = 20
457-
x = np.linspace(-180, 180, n)
458-
y1 = np.linspace(-85, 85, n)
459-
y2 = np.linspace(-85, 85, n)
460-
data = state.rand(len(x) - 1, len(y2) - 1)
461-
for ax, scale, color in zip(axs[4:], ('sine', 'mercator'), ('coral', 'sky blue')):
462-
ax.plot(x, y1, '-', color=color, lw=4)
463-
ax.pcolormesh(x, y2, data, cmap='grays', cmap_kw={'right': 0.8})
463+
# Power scales
464+
for ax, power, color in zip(axs[4:], (2, 1 / 4), colors):
465+
ax.pcolormesh(x, y, data, cmap='grays', cmap_kw={'right': 0.8})
466+
ax.plot(x, y, lw=4, color=color)
464467
ax.format(
465-
title=scale.title() + ' y-axis', yscale=scale, ytickloc='left',
466-
yformatter='deg', grid=False, ylocator=20,
467-
xscale='linear', xlim=None, ylim=(-85, 85)
468+
ylim=(0.1, 10), yscale=('power', power),
469+
title=f'$x^{{{power}}}$'
468470
)
469471

470472

docs/projections.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,8 @@
3535
# a dictionary of projection names with the subplot number as the key -- for example,
3636
# a 2-column figure with a Cartesian axes on the left and a Plate Carrée projection
3737
# on the right can be built with either ``proj=('cartesian', 'pcarree')`` or
38-
# ``proj={2: 'pcarree'}``. The *default* projection is always
39-
# `~proplot.axes.CartesianAxes` and can be explicitly specified with
40-
# the ``'cartesian'`` key.
38+
# ``proj={2: 'pcarree'}``. The default "projection" is `~proplot.axes.CartesianAxes`
39+
# and can be explicitly specified with the ``'cartesian'`` key.
4140

4241

4342
# %% [raw] raw_mimetype="text/restructuredtext"
@@ -47,8 +46,8 @@
4746
# ---------------
4847
#
4948
# ProPlot can create geographic projection axes using
50-
# either `cartopy`_ or `basemap`_ as "backends". To draw geographic axes, pass
51-
# ``proj='name'`` or e.g. ``proj={2: 'name'}`` (:ref:`see above <ug_proj>`) to
49+
# either `cartopy`_ or `basemap`_ as "backends". To create geographic axes, pass
50+
# ``proj='name'`` or e.g. ``proj={2: 'name'}`` (see :ref:`above <ug_proj>`) to
5251
# `~proplot.ui.subplots` where ``name`` is any valid :ref:`PROJ projection name
5352
# <proj_included>`. You can also use ``proj=projection_instance``, where
5453
# ``projection_instance`` is a `cartopy.crs.Projection` or
@@ -164,8 +163,8 @@
164163
# %% [raw] raw_mimetype="text/restructuredtext"
165164
# .. _ug_geoplot:
166165
#
167-
# Geographic plotting
168-
# -------------------
166+
# Plotting in projections
167+
# -----------------------
169168
#
170169
# In ProPlot, plotting with `~proplot.axes.GeoAxes` is not much different from
171170
# plotting with `~proplot.axes.CartesianAxes`. ProPlot makes longitude-latitude (i.e.,
@@ -430,15 +429,16 @@
430429
# Polar axes
431430
# ----------
432431
#
433-
# To draw `polar axes <polar_>`_, pass ``proj='polar'`` or e.g. ``proj={1: 'polar'}``
434-
# to `~proplot.ui.subplots`. This generates a `proplot.axes.PolarAxes` instance with
435-
# its own `~proplot.axes.PolarAxes.format` method.
432+
# To create `polar axes <polar_>`_, pass ``proj='polar'`` or e.g. ``proj={2: 'polar'}``
433+
# (see :ref:`above <ug_proj>`) to `~proplot.ui.subplots`. This generates a
434+
# `proplot.axes.PolarAxes` instance with its own `~proplot.axes.PolarAxes.format`
435+
# method.
436436
#
437437
# The `proplot.axes.PolarAxes.format` method facilitates polar-specific axes
438438
# modifications like changing the central radius `r0`, the zero azimuth location
439439
# `theta0`, and the positive azimuthal direction `thetadir`. It also supports
440440
# changing gridline locations with `rlocator` and `thetalocator` (analogous to
441-
# `ylocator` and `xlocator` used by `~proplot.axes.CartesianAxes.format`) and
441+
# `ylocator` and `xlocator` used by `proplot.axes.CartesianAxes.format`) and
442442
# turning your polar plot into an "annular" or "sector" plot by changing the radial
443443
# limits `rlim` or the azimuthal limits `thetalim`. Finally, since
444444
# `proplot.axes.PolarAxes.format` calls `proplot.axes.Axes.format`, it can be used to

proplot/axes/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1002,7 +1002,7 @@ def format(
10021002
---------
10031003
The `abc`, `abcstyle`, `abcloc`, `titleloc`, `titleabove`, `titlepad`,
10041004
`abctitlepad`, `leftlabelpad`, `toplabelpad`, `rightlabelpad`, and
1005-
`bottomlabelpad` keywords and are :ref:`configuration settings <ug_config>`.
1005+
`bottomlabelpad` keywords are :ref:`configuration settings <ug_config>`.
10061006
We explicitly document these arguments here because it is very common to change
10071007
them. But many :ref:`other configuration settings <ug_format>` can be passed
10081008
to ``format`` too.

0 commit comments

Comments
 (0)