Skip to content

Commit 86f7699

Browse files
committed
Rename (cmap|cycle)_changer --> apply_(cmap|cycle)
1 parent 0fe7b29 commit 86f7699

File tree

11 files changed

+114
-111
lines changed

11 files changed

+114
-111
lines changed

docs/1dplots.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@
146146

147147

148148
# %% [raw] raw_mimetype="text/restructuredtext"
149-
# .. _ug_cycle_changer:
149+
# .. _ug_apply_cycle:
150150
#
151151
# Property cycles
152152
# ---------------
@@ -155,7 +155,7 @@
155155
# <https://matplotlib.org/tutorials/intermediate/color_cycle.html#sphx-glr-tutorials-intermediate-color-cycle-py>`__
156156
# and use different property cycles for different plot elements. You can create and
157157
# apply property cycles on-the-fly using the `cycle` and `cycle_kw` arguments, available
158-
# with any plotting method wrapped by `~proplot.axes.cycle_changer`. `cycle` and
158+
# with any plotting method wrapped by `~proplot.axes.apply_cycle`. `cycle` and
159159
# `cycle_kw` are passed to the `~proplot.constructor.Cycle` :ref:`constructor function
160160
# <why_constructor>`, and the resulting property cycle is used for the plot. You can
161161
# specify `cycle` once with 2D input data (in which case each column is plotted in
@@ -280,7 +280,7 @@
280280
#
281281
# The `~matplotlib.axes.Axes.bar` and `~matplotlib.axes.Axes.barh` methods
282282
# are wrapped by `~proplot.axes.bar_wrapper`,
283-
# `~proplot.axes.cycle_changer`, and `~proplot.axes.standardize_1d`.
283+
# `~proplot.axes.apply_cycle`, and `~proplot.axes.standardize_1d`.
284284
# You can now *group* or *stack* columns of data by passing 2D arrays to
285285
# `~matplotlib.axes.Axes.bar` or `~matplotlib.axes.Axes.barh`, just like in
286286
# `pandas`_, or use different colors for negative and positive bars by
@@ -401,7 +401,7 @@
401401
#
402402
# The `~matplotlib.axes.Axes.boxplot` and `~matplotlib.axes.Axes.violinplot`
403403
# methods are now wrapped with `~proplot.axes.boxplot_wrapper`,
404-
# `~proplot.axes.violinplot_wrapper`, `~proplot.axes.cycle_changer`,
404+
# `~proplot.axes.violinplot_wrapper`, `~proplot.axes.apply_cycle`,
405405
# and `~proplot.axes.standardize_1d`. These wrappers add some useful
406406
# options and apply aesthetically pleasing default settings. They also
407407
# automatically apply axis labels based on the `~pandas.DataFrame` column
@@ -513,7 +513,7 @@
513513
# ----------------------
514514
#
515515
# The `~matplotlib.axes.Axes.scatter` method is now wrapped by
516-
# `~proplot.axes.scatter_wrapper`, `~proplot.axes.cycle_changer`, and
516+
# `~proplot.axes.scatter_wrapper`, `~proplot.axes.apply_cycle`, and
517517
# `~proplot.axes.standardize_1d`. This means that
518518
# `~matplotlib.axes.Axes.scatter` now accepts 2D arrays, just like
519519
# `~matplotlib.axes.Axes.plot`. Also, successive calls to

docs/2dplots.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@
147147

148148

149149
# %% [raw] raw_mimetype="text/restructuredtext"
150-
# .. _ug_cmap_changer:
150+
# .. _ug_apply_cmap:
151151
#
152152
# Colormaps and normalizers
153153
# -------------------------
@@ -156,12 +156,12 @@
156156
# explicitly calling the `~proplot.constructor.Colormap`
157157
# :ref:`constructor function <why_constructor>`.
158158
# You can do so using the `cmap` and `cmap_kw` arguments, available with any
159-
# plotting method wrapped by `~proplot.axes.cmap_changer`. `cmap` and `cmap_kw`
159+
# plotting method wrapped by `~proplot.axes.apply_cmap`. `cmap` and `cmap_kw`
160160
# are passed to `~proplot.constructor.Colormap` and the resulting colormap is
161161
# used for the plot. For example, to create and apply a monochromatic colormap,
162162
# you can simply use ``cmap='color name'``.
163163
#
164-
# The `~proplot.axes.cmap_changer` wrapper also
164+
# The `~proplot.axes.apply_cmap` wrapper also
165165
# adds the `norm` and `norm_kw` arguments. They are passed to the
166166
# `~proplot.constructor.Norm` :ref:`constructor function <why_constructor>`,
167167
# and the resulting normalizer is used for the plot. For more information on colormaps
@@ -197,7 +197,7 @@
197197
# Discrete colormap levels
198198
# ------------------------
199199
#
200-
# The `~proplot.axes.cmap_changer` wrapper also applies the
200+
# The `~proplot.axes.apply_cmap` wrapper also applies the
201201
# `~proplot.colors.DiscreteNorm` normalizer to every colormap plot.
202202
# `~proplot.colors.DiscreteNorm` converts data values to colormap colors by (1)
203203
# transforming data using an arbitrary *continuous* normalizer (e.g.
@@ -356,19 +356,19 @@
356356
# Contour and gridbox labels
357357
# --------------------------
358358
#
359-
# The `~proplot.axes.cmap_changer` wrapper also allows you to quickly add
359+
# The `~proplot.axes.apply_cmap` wrapper also allows you to quickly add
360360
# *labels* to `~proplot.axes.Axes.heatmap`, `~matplotlib.axes.Axes.pcolor`,
361361
# `~matplotlib.axes.Axes.pcolormesh`, `~matplotlib.axes.Axes.contour`, and
362362
# `~matplotlib.axes.Axes.contourf` plots by simply using ``labels=True``.
363363
# The label text is colored black or white depending on the luminance of
364364
# the underlying grid box or filled contour.
365365
#
366-
# `~proplot.axes.cmap_changer` draws contour labels with
366+
# `~proplot.axes.apply_cmap` draws contour labels with
367367
# `~matplotlib.axes.Axes.clabel` and grid box labels with
368368
# `~matplotlib.axes.Axes.text`. You can pass keyword arguments to these
369369
# functions using the `labels_kw` dictionary keyword argument, and change the
370370
# label precision with the `precision` keyword argument. See
371-
# `~proplot.axes.cmap_changer` for details.
371+
# `~proplot.axes.apply_cmap` for details.
372372

373373
# %%
374374
import proplot as plot

docs/colorbars_legends.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@
6060
# one go, pass a location (e.g., ``legend='r'`` or ``colorbar='r'``) to
6161
# methods that accept a `cycle` argument (e.g., `~matplotlib.axes.Axes.plot`).
6262
# Use `legend_kw` and `colorbar_kw` to pass keyword arguments to the colorbar
63-
# and legend functions. This feature is powered by the `~proplot.axes.cmap_changer` and
64-
# `~proplot.axes.cycle_changer` wrappers.
63+
# and legend functions. This feature is powered by the `~proplot.axes.apply_cmap` and
64+
# `~proplot.axes.apply_cycle` wrappers.
6565

6666
# %%
6767
import proplot as plot

docs/colormaps.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@
158158
# your convenience, most of these features can be accessed via the
159159
# `~proplot.constructor.Colormap` :ref:`constructor function <why_constructor>`. Note
160160
# that every plotting command that accepts a `cmap` keyword passes it through this
161-
# function (see `~proplot.axes.cmap_changer`).
161+
# function (see `~proplot.axes.apply_cmap`).
162162
#
163163
# To make `~proplot.colors.PerceptuallyUniformColormap`\ s from scratch, you
164164
# have the following three options:

docs/cycles.py

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

docs/why.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ The following features are relevant for "1D" plotting methods like
419419
these functions. You do not have to work with the
420420
`~matplotlib.axes.Axes.errorbar` method separately.
421421
* All :ref:`1D plotting methods <ug_1dplots>` accept a
422-
`cycle` :ref:`keyword argument <ug_cycle_changer>`
422+
`cycle` :ref:`keyword argument <ug_apply_cycle>`
423423
interpreted by `~proplot.constructor.Cycle` and
424424
`colorbar` and `legend` :ref:`keyword arguments <ug_cbars_axes>`
425425
for drawing colorbars and legends at the specified location.
@@ -454,7 +454,7 @@ The following features are relevant for "2D" plotting methods like
454454
<https://stackoverflow.com/q/27092991/4970632>`__, and `colorbar patches
455455
<https://stackoverflow.com/q/15003353/4970632>`__.
456456
* All :ref:`2D plotting methods <ug_2dplots>` methods accept
457-
`cmap` and `norm` :ref:`keyword arguments <ug_cmap_changer>`
457+
`cmap` and `norm` :ref:`keyword arguments <ug_apply_cmap>`
458458
interpreted by `~proplot.constructor.Colormap` and
459459
`~proplot.constructor.Norm` and a `colorbar` :ref:`keyword argument <ug_cbars_axes>`
460460
for drawing colorbars at the specified location.

proplot/axes/base.py

Lines changed: 30 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@
2222
from ..internals import _not_none, docstring, rcsetup, warnings
2323
from ..utils import edges, units
2424
from .plot import (
25+
_apply_cmap,
26+
_apply_cycle,
2527
_bar_wrapper,
2628
_barh_wrapper,
2729
_boxplot_wrapper,
28-
_cmap_changer,
29-
_cycle_changer,
3030
_fill_between_wrapper,
3131
_fill_betweenx_wrapper,
3232
_get_transform,
@@ -263,7 +263,7 @@ def __init__(self, *args, number=None, main=False, _subplotspec=None, **kwargs):
263263
ta = self.transAxes
264264
d['abc'] = self.text(0, 0, '', transform=ta)
265265
d['left'] = self._left_title # WARNING: track in case mpl changes this
266-
d['center'] = self._center_title
266+
d['center'] = self.title
267267
d['right'] = self._right_title
268268
d['upper left'] = self.text(0, 0, '', va='top', ha='left', transform=ta)
269269
d['upper center'] = self.text(0, 0, '', va='top', ha='center', transform=ta)
@@ -1272,7 +1272,7 @@ def panel_axes(self, side, **kwargs):
12721272

12731273
@_parametric_wrapper
12741274
@_standardize_1d
1275-
@_cmap_changer
1275+
@_apply_cmap
12761276
def parametric(
12771277
self, *args, values=None,
12781278
cmap=None, norm=None, interp=0,
@@ -1810,47 +1810,44 @@ def number(self, num):
18101810
raise ValueError(f'Invalid number {num!r}. Must be integer >=1.')
18111811
self._number = num
18121812

1813-
# For consistency with _left_title, _upper_left_title, etc.
1814-
_center_title = property(lambda self: self.title)
1815-
18161813
# Wrapped by special functions
18171814
# Also support redirecting to Basemap methods
18181815
text = _text_wrapper(
18191816
maxes.Axes.text
18201817
)
1821-
plot = _plot_wrapper(_standardize_1d(_indicate_error(_cycle_changer(
1818+
plot = _plot_wrapper(_standardize_1d(_indicate_error(_apply_cycle(
18221819
maxes.Axes.plot
18231820
))))
1824-
scatter = _scatter_wrapper(_standardize_1d(_indicate_error(_cycle_changer(
1821+
scatter = _scatter_wrapper(_standardize_1d(_indicate_error(_apply_cycle(
18251822
maxes.Axes.scatter
18261823
))))
1827-
bar = _bar_wrapper(_standardize_1d(_indicate_error(_cycle_changer(
1824+
bar = _bar_wrapper(_standardize_1d(_indicate_error(_apply_cycle(
18281825
maxes.Axes.bar
18291826
))))
18301827
barh = _barh_wrapper( # calls self.bar
18311828
maxes.Axes.barh
18321829
)
1833-
hist = _hist_wrapper(_standardize_1d(_cycle_changer(
1830+
hist = _hist_wrapper(_standardize_1d(_apply_cycle(
18341831
maxes.Axes.hist
18351832
)))
1836-
boxplot = _boxplot_wrapper(_standardize_1d(_cycle_changer(
1833+
boxplot = _boxplot_wrapper(_standardize_1d(_apply_cycle(
18371834
maxes.Axes.boxplot
18381835
)))
1839-
violinplot = _violinplot_wrapper(_standardize_1d(_indicate_error(_cycle_changer(
1836+
violinplot = _violinplot_wrapper(_standardize_1d(_indicate_error(_apply_cycle(
18401837
maxes.Axes.violinplot
18411838
))))
1842-
fill_between = _fill_between_wrapper(_standardize_1d(_cycle_changer(
1839+
fill_between = _fill_between_wrapper(_standardize_1d(_apply_cycle(
18431840
maxes.Axes.fill_between
18441841
)))
1845-
fill_betweenx = _fill_betweenx_wrapper(_standardize_1d(_cycle_changer(
1842+
fill_betweenx = _fill_betweenx_wrapper(_standardize_1d(_apply_cycle(
18461843
maxes.Axes.fill_betweenx
18471844
)))
18481845

18491846
# Wrapped by cycle wrapper and standardized
1850-
pie = _standardize_1d(_cycle_changer(
1847+
pie = _standardize_1d(_apply_cycle(
18511848
maxes.Axes.pie
18521849
))
1853-
step = _standardize_1d(_cycle_changer(
1850+
step = _standardize_1d(_apply_cycle(
18541851
maxes.Axes.step
18551852
))
18561853

@@ -1867,53 +1864,53 @@ def number(self, num):
18671864

18681865
# Wrapped by cmap wrapper and standardized
18691866
# Also support redirecting to Basemap methods
1870-
hexbin = _standardize_1d(_cmap_changer(
1867+
hexbin = _standardize_1d(_apply_cmap(
18711868
maxes.Axes.hexbin
18721869
))
1873-
contour = _standardize_2d(_cmap_changer(
1870+
contour = _standardize_2d(_apply_cmap(
18741871
maxes.Axes.contour
18751872
))
1876-
contourf = _standardize_2d(_cmap_changer(
1873+
contourf = _standardize_2d(_apply_cmap(
18771874
maxes.Axes.contourf
18781875
))
1879-
pcolor = _standardize_2d(_cmap_changer(
1876+
pcolor = _standardize_2d(_apply_cmap(
18801877
maxes.Axes.pcolor
18811878
))
1882-
pcolormesh = _standardize_2d(_cmap_changer(
1879+
pcolormesh = _standardize_2d(_apply_cmap(
18831880
maxes.Axes.pcolormesh
18841881
))
1885-
pcolorfast = _standardize_2d(_cmap_changer(
1882+
pcolorfast = _standardize_2d(_apply_cmap(
18861883
maxes.Axes.pcolorfast # WARNING: not available in cartopy and basemap
18871884
))
1888-
streamplot = _standardize_2d(_cmap_changer(
1885+
streamplot = _standardize_2d(_apply_cmap(
18891886
maxes.Axes.streamplot
18901887
))
1891-
quiver = _standardize_2d(_cmap_changer(
1888+
quiver = _standardize_2d(_apply_cmap(
18921889
maxes.Axes.quiver
18931890
))
1894-
barbs = _standardize_2d(_cmap_changer(
1891+
barbs = _standardize_2d(_apply_cmap(
18951892
maxes.Axes.barbs
18961893
))
1897-
imshow = _cmap_changer(
1894+
imshow = _apply_cmap(
18981895
maxes.Axes.imshow
18991896
)
19001897

19011898
# Wrapped only by cmap wrapper
1902-
tripcolor = _cmap_changer(
1899+
tripcolor = _apply_cmap(
19031900
maxes.Axes.tripcolor
19041901
)
1905-
tricontour = _cmap_changer(
1902+
tricontour = _apply_cmap(
19061903
maxes.Axes.tricontour
19071904
)
1908-
tricontourf = _cmap_changer(
1905+
tricontourf = _apply_cmap(
19091906
maxes.Axes.tricontourf
19101907
)
1911-
hist2d = _cmap_changer(
1908+
hist2d = _apply_cmap(
19121909
maxes.Axes.hist2d
19131910
)
1914-
spy = _cmap_changer(
1911+
spy = _apply_cmap(
19151912
maxes.Axes.spy
19161913
)
1917-
matshow = _cmap_changer(
1914+
matshow = _apply_cmap(
19181915
maxes.Axes.matshow
19191916
)

0 commit comments

Comments
 (0)