Skip to content

Commit e9e5651

Browse files
committed
Move wrappers.py to axes/plot.py, prepare to add to classes
1 parent a4d4a2a commit e9e5651

File tree

18 files changed

+87
-85
lines changed

18 files changed

+87
-85
lines changed

docs/1dplots.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
# It is often desirable to use different `property cycles
4141
# <https://matplotlib.org/tutorials/intermediate/color_cycle.html#sphx-glr-tutorials-intermediate-color-cycle-py>`__
4242
# for different axes or different plot elements. To enable this, the
43-
# `~proplot.wrappers.cycle_changer` adds the `cycle` and `cycle_kw` to the 1D
43+
# `~proplot.axes.cycle_changer` adds the `cycle` and `cycle_kw` to the 1D
4444
# plotting methods. These arguments are passed to the
4545
# `~proplot.constructor.Cycle` constructor function, and the resulting property
4646
# cycle is used to style the input data. ProPlot iterates through property
@@ -76,9 +76,9 @@
7676
# Standardized arguments
7777
# ----------------------
7878
#
79-
# The `~proplot.wrappers.standardize_1d` wrapper is used to standardize
79+
# The `~proplot.axes.standardize_1d` wrapper is used to standardize
8080
# positional arguments across all 1D plotting methods.
81-
# `~proplot.wrappers.standardize_1d` allows you to optionally omit *x*
81+
# `~proplot.axes.standardize_1d` allows you to optionally omit *x*
8282
# coordinates, in which case they are inferred from the data. It also permits
8383
# passing 2D *y* coordinate arrays to any plotting method, in which case the
8484
# plotting method is called for each column of the array.
@@ -122,7 +122,7 @@
122122
# Pandas and xarray integration
123123
# -----------------------------
124124
#
125-
# The `~proplot.wrappers.standardize_1d` wrapper integrates 1D plotting
125+
# The `~proplot.axes.standardize_1d` wrapper integrates 1D plotting
126126
# methods with pandas `~pandas.DataFrame`\ s and xarray `~xarray.DataArray`\ s.
127127
# When you pass a DataFrame or DataArray to any plotting command, the x-axis
128128
# label, y-axis label, legend label, colorbar label, and/or title are
@@ -185,20 +185,20 @@
185185
# Adding error bars
186186
# -----------------
187187
#
188-
# The `~proplot.wrappers.add_errorbars` wrapper lets you draw error bars
188+
# The `~proplot.axes.add_errorbars` wrapper lets you draw error bars
189189
# on-the-fly by passing certain keyword arguments to
190190
# `~matplotlib.axes.Axes.plot`, `~matplotlib.axes.Axes.scatter`,
191191
# `~matplotlib.axes.Axes.bar`, or `~matplotlib.axes.Axes.barh`.
192192
#
193193
# If you pass 2D arrays to these methods with ``means=True`` or
194194
# ``medians=True``, the means or medians of each column are drawn as points,
195195
# lines, or bars, and error bars are drawn to represent the spread in each
196-
# column. `~proplot.wrappers.add_errorbars` lets you draw both thin error
196+
# column. `~proplot.axes.add_errorbars` lets you draw both thin error
197197
# "bars" with optional whiskers, and thick error "boxes" overlayed on top of
198198
# these bars (this can be used to represent different percentil ranges).
199199
# Instead of using 2D arrays, you can also pass error bar coordinates
200200
# *manually* with the `bardata` and `boxdata` keyword arguments. See
201-
# `~proplot.wrappers.add_errorbars` for details.
201+
# `~proplot.axes.add_errorbars` for details.
202202

203203
# %%
204204
import proplot as plot
@@ -254,8 +254,8 @@
254254
# ------------------------
255255
#
256256
# The `~matplotlib.axes.Axes.bar` and `~matplotlib.axes.Axes.barh` methods
257-
# are wrapped by `~proplot.wrappers.bar_wrapper`,
258-
# `~proplot.wrappers.cycle_changer`, and `~proplot.wrappers.standardize_1d`.
257+
# are wrapped by `~proplot.axes.bar_wrapper`,
258+
# `~proplot.axes.cycle_changer`, and `~proplot.axes.standardize_1d`.
259259
# You can now *group* or *stack* columns of data by passing 2D arrays to
260260
# `~matplotlib.axes.Axes.bar` or `~matplotlib.axes.Axes.barh`, just like in
261261
# `pandas`. Also, `~matplotlib.axes.Axes.bar` and `~matplotlib.axes.Axes.barh`
@@ -266,8 +266,8 @@
266266
# `~proplot.axes.Axes.areax` methods. These are alises for
267267
# `~matplotlib.axes.Axes.fill_between` and
268268
# `~matplotlib.axes.Axes.fill_betweenx`, which are now wrapped by
269-
# `~proplot.wrappers.fill_between_wrapper` and
270-
# `~proplot.wrappers.fill_betweenx_wrapper`. You can now *stack* or *overlay*
269+
# `~proplot.axes.fill_between_wrapper` and
270+
# `~proplot.axes.fill_betweenx_wrapper`. You can now *stack* or *overlay*
271271
# columns of data by passing 2D arrays to `~proplot.axes.Axes.area` and
272272
# `~proplot.axes.Axes.areax`, just like in `pandas`. You can also now draw
273273
# area plots that *change color* when the fill boundaries cross each other by
@@ -350,9 +350,9 @@
350350
# --------------------------
351351
#
352352
# The `~matplotlib.axes.Axes.boxplot` and `~matplotlib.axes.Axes.violinplot`
353-
# methods are now wrapped with `~proplot.wrappers.boxplot_wrapper`,
354-
# `~proplot.wrappers.violinplot_wrapper`, `~proplot.wrappers.cycle_changer`,
355-
# and `~proplot.wrappers.standardize_1d`. These wrappers add some useful
353+
# methods are now wrapped with `~proplot.axes.boxplot_wrapper`,
354+
# `~proplot.axes.violinplot_wrapper`, `~proplot.axes.cycle_changer`,
355+
# and `~proplot.axes.standardize_1d`. These wrappers add some useful
356356
# options and apply aesthetically pleasing default settings. They also
357357
# automatically apply axis labels based on the `~pandas.DataFrame` column
358358
# labels or the input *x* coordinate labels.
@@ -456,8 +456,8 @@
456456
# -------------
457457
#
458458
# The `~matplotlib.axes.Axes.scatter` method is now wrapped by
459-
# `~proplot.wrappers.scatter_wrapper`, `~proplot.wrappers.cycle_changer`, and
460-
# `~proplot.wrappers.standardize_1d`. This means that
459+
# `~proplot.axes.scatter_wrapper`, `~proplot.axes.cycle_changer`, and
460+
# `~proplot.axes.standardize_1d`. This means that
461461
# `~matplotlib.axes.Axes.scatter` now accepts 2D arrays, just like
462462
# `~matplotlib.axes.Axes.plot`. Also, successive calls to
463463
# `~matplotlib.axes.Axes.scatter` now use the property cycler properties

docs/2dplots.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,14 @@
3939
#
4040
# It is often desirable to create ProPlot colormaps on-the-fly, without
4141
# explicitly using the `~proplot.constructor.Colormap` constructor function.
42-
# To enable this, the `~proplot.wrappers.cmap_changer` wrapper adds the
42+
# To enable this, the `~proplot.axes.cmap_changer` wrapper adds the
4343
# `cmap` and `cmap_kw` arguments to every 2D plotting method. These
4444
# arguments are passed to the `~proplot.constructor.Colormap` constructor
4545
# function, and the resulting colormap is used for the input data. For
4646
# example, to create and apply a monochromatic colormap, you can simply use
4747
# ``cmap='color name'``.
4848

49-
# The `~proplot.wrappers.cmap_changer` wrapper also
49+
# The `~proplot.axes.cmap_changer` wrapper also
5050
# adds the `norm` and `norm_kw` arguments. They are passed to the
5151
# `~proplot.constructor.Norm` constructor function, and the resulting
5252
# normalizer is used for the input data. For more information on colormaps
@@ -80,7 +80,7 @@
8080
# Discrete colormap levels
8181
# ------------------------
8282
#
83-
# The `~proplot.wrappers.cmap_changer` wrapper also applies the
83+
# The `~proplot.axes.cmap_changer` wrapper also applies the
8484
# `~proplot.colors.DiscreteNorm` normalizer to every colormap plot.
8585
# `~proplot.colors.DiscreteNorm` converts data values to colormap colors by (1)
8686
# transforming data using an arbitrary *continuous* normalizer (e.g.
@@ -212,7 +212,7 @@
212212
# Standardized arguments
213213
# ----------------------
214214
#
215-
# The `~proplot.wrappers.standardize_2d` wrapper is used to standardize
215+
# The `~proplot.axes.standardize_2d` wrapper is used to standardize
216216
# positional arguments across all 2D plotting methods. Among other things,
217217
# it guesses coordinate *edges* for `~matplotlib.axes.Axes.pcolor` and
218218
# `~matplotlib.axes.Axes.pcolormesh` plots when you supply coordinate
@@ -255,7 +255,7 @@
255255
# Pandas and xarray integration
256256
# -----------------------------
257257
#
258-
# The `~proplot.wrappers.standardize_2d` wrapper also integrates 2D
258+
# The `~proplot.axes.standardize_2d` wrapper also integrates 2D
259259
# plotting methods with pandas `~pandas.DataFrame`\ s and xarray
260260
# `~xarray.DataArray`\ s. When you pass a DataFrame or DataArray to any
261261
# plotting command, the x-axis label, y-axis label, legend label, colorbar
@@ -328,19 +328,19 @@
328328
# Contour and gridbox labels
329329
# --------------------------
330330
#
331-
# The `~proplot.wrappers.cmap_changer` wrapper also allows you to quickly add
331+
# The `~proplot.axes.cmap_changer` wrapper also allows you to quickly add
332332
# *labels* to `~proplot.axes.Axes.heatmap`, `~matplotlib.axes.Axes.pcolor`,
333333
# `~matplotlib.axes.Axes.pcolormesh`, `~matplotlib.axes.Axes.contour`, and
334334
# `~matplotlib.axes.Axes.contourf` plots by simply using ``labels=True``.
335335
# Critically, the label text is colored black or white depending on the
336336
# luminance of the underlying grid box or filled contour.
337337
#
338-
# `~proplot.wrappers.cmap_changer` draws contour labels with
338+
# `~proplot.axes.cmap_changer` draws contour labels with
339339
# `~matplotlib.axes.Axes.clabel` and grid box labels with
340340
# `~matplotlib.axes.Axes.text`. You can pass keyword arguments to these
341341
# functions using the `labels_kw` dictionary keyword argument, and change the
342342
# label precision with the `precision` keyword argument. See
343-
# `~proplot.wrappers.cmap_changer` for details.
343+
# `~proplot.axes.cmap_changer` for details.
344344

345345
# %%
346346
import proplot as plot

docs/api.rst

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Axes classes
2828

2929
.. automodsumm:: proplot.axes
3030
:toctree: api
31-
:skip: ProjAxes, XYAxes
31+
:classes-only:
3232

3333

3434
Constructor functions
@@ -52,13 +52,15 @@ Configuration tools
5252
Plotting wrappers
5353
=================
5454

55-
.. automodule:: proplot.wrappers
55+
.. automodule:: proplot.axes.plot
5656

57-
.. automodsumm:: proplot.wrappers
57+
.. automodsumm:: proplot.axes
5858
:toctree: api
59+
:functions-only:
60+
:skip: ProjAxes, XYAxes
5961

6062

61-
Show functions
63+
Demo functions
6264
==============
6365

6466
.. automodule:: proplot.demos

docs/axis.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,8 @@
269269
# %% [raw] raw_mimetype="text/restructuredtext"
270270
# .. _ug_scales:
271271
#
272-
# Axis scales
273-
# -----------
272+
# Changing the axis scale
273+
# -----------------------
274274
#
275275
# "Axis scales" like ``'linear'`` and ``'log'`` control the *x* and *y* axis
276276
# coordinate system. To change the axis scale, simply pass e.g.
@@ -448,8 +448,7 @@
448448
# In the latter case, the scale's transforms are used for the forward and
449449
# inverse functions, and the scale's default locators and formatters are used
450450
# for the default `~proplot.scale.FuncScale` locators and formatters.
451-
#
452-
# Notably, the "parent" axis scale is now *arbitrary* -- in the first example
451+
# Note that the "parent" axis scale is now arbitrary -- in the first example
453452
# shown below, we create a `~proplot.axes.CartesianAxes.dualx` axis for an
454453
# axis scaled by the ``'symlog'`` scale.
455454

docs/colorbars_legends.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@
4343
# `~matplotlib.axes.Axes.contourf`). To draw a legend or colorbar-legend in
4444
# one go, pass a location (e.g. ``legend='r'`` or ``colorbar='r'``) to
4545
# methods that accept a `cycle` argument (e.g. `~matplotlib.axes.Axes.plot`).
46-
# This feature is powered by the `~proplot.wrappers.cmap_changer` and
47-
# `~proplot.wrappers.cycle_changer` wrappers.
46+
# This feature is powered by the `~proplot.axes.cmap_changer` and
47+
# `~proplot.axes.cycle_changer` wrappers.
4848
#
4949
# Finally, just like matplotlib "inset" legends, ProPlot also supports
5050
# "inset" *colorbars*. To draw an inset colorbar, pass an inset location to
@@ -185,7 +185,7 @@
185185
#
186186
# The `~proplot.figure.Figure` `~proplot.figure.Figure.colorbar` and
187187
# `~proplot.axes.Axes` `~proplot.axes.Axes.colorbar` methods are wrapped by
188-
# `~proplot.wrappers.colorbar_wrapper`, which adds several new features.
188+
# `~proplot.axes.colorbar_wrapper`, which adds several new features.
189189
#
190190
# You can now draw colorbars from *lists of colors* or *lists of artists* by
191191
# passing a list instead of a mappable object. Colorbar minor ticks are now
@@ -243,7 +243,7 @@
243243
#
244244
# The `~proplot.figure.Figure` `~proplot.figure.Figure.legend` and
245245
# `~proplot.axes.Axes` `~proplot.axes.Axes.legend` methods are wrapped by
246-
# `~proplot.wrappers.legend_wrapper`, which adds several new features.
246+
# `~proplot.axes.legend_wrapper`, which adds several new features.
247247
#
248248
# You can draw legends with *centered legend rows*, either by passing
249249
# ``center=True`` or by passing *list of lists* of plot handles. This is

docs/colormaps.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@
139139
# your convenience, most of these features can be accessed via the
140140
# `~proplot.constructor.Colormap` constructor function. Note that every
141141
# plotting command that accepts a `cmap` keyword passes it through this
142-
# function (see `~proplot.wrappers.cmap_changer`).
142+
# function (see `~proplot.axes.cmap_changer`).
143143
#
144144
# To make `~proplot.colors.PerceptuallyUniformColormap`\ s from scratch, you
145145
# have the following three options:

docs/cycles.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
# commands like `~matplotlib.axes.Axes.plot` and
5959
# `~matplotlib.axes.Axes.scatter` now accept a `cycle` keyword arg, which is
6060
# passed to `~proplot.constructor.Cycle` (see
61-
# `~proplot.wrappers.cycle_changer`). To save your color cycle data and use
61+
# `~proplot.axes.cycle_changer`). To save your color cycle data and use
6262
# it every time ProPlot is imported, simply pass ``save=True`` to
6363
# `~proplot.constructor.Cycle`. If you want to change the global property
6464
# cycler, pass a *name* to the :rcraw:`cycle` setting or pass the result of

docs/projections.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,8 @@
181181
#
182182
# The below example demonstrates how to plot geographic data with ProPlot.
183183
# It is mostly the same as cartopy, but with some new features powered by the
184-
# `~proplot.wrappers.standardize_2d`, `~proplot.wrappers.default_transform`,
185-
# and `~proplot.wrappers.default_latlon` wrappers.
184+
# `~proplot.axes.standardize_2d`, `~proplot.axes.default_transform`,
185+
# and `~proplot.axes.default_latlon` wrappers.
186186
#
187187
# * For both basemap and cartopy projections, you can pass ``globe=True`` to
188188
# 2D plotting commands to ensure global data coverage.

docs/why.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -441,10 +441,10 @@ designed to make your life easier.
441441
442442
..
443443
All positional arguments for 1D plotting methods are standardized by
444-
`~proplot.wrappers.standardize_1d`. All positional arguments for 2D
445-
plotting methods are standardized by `~proplot.wrappers.standardize_2d`.
446-
See :ref:`1D plotting wrappers` and :ref:`2D plotting wrappers` for
447-
details.
444+
`~proplot.axes.standardize_1d`. All positional arguments for 2D
445+
plotting methods are standardized by `~proplot.axes.standardize_2d`.
446+
See :ref:`1D plotting methods <1d_plots>` and :ref:`2D plotting methods <2d_plots>`
447+
for details.
448448
449449

450450
.. _why_xarray_pandas:

proplot/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
from .scale import * # noqa: F401 F403
1616
from .gridspec import * # noqa: F401 F403
1717
from .constructor import * # noqa: F401 F403
18-
from .wrappers import * # noqa: F401 F403
1918
from .axes import * # noqa: F401 F403
2019
from .figure import * # noqa: F401 F403
2120
from .ui import * # noqa: F401 F403

0 commit comments

Comments
 (0)