Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions WHATSNEW.rst
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ Documentation
-------------

* Populate docs with examples of passing ``format`` arguments to figure and axes
instantiation commands (e.g. ``pplt.figure``, ``fig.subplot``) (:commit:`803a889f`).
instantiation commands (e.g. ``uplt.figure``, ``fig.subplot``) (:commit:`803a889f`).
* Improve website colormap and cycle table rendering time by rasterizing colorbar
data and add `rasterize` as optional keyword arg (:commit:`1a875fc2`).

Expand Down Expand Up @@ -536,7 +536,7 @@ Features
--------

* Permit passing ``format`` keywords when instantiating figures and axes
(:commit:`ae98378d`). For example: ``pplt.figure(suptitle='Super title')``
(:commit:`ae98378d`). For example: ``uplt.figure(suptitle='Super title')``
or ``fig.add_subplot(111, xcolor='gray', xticks=10)`` .
* Add back `color` as a valid `ultraplot.axes.CartesianAxes.format` keyword
arg for consistency with `xcolor` and `ycolor` (:commit:`ecb6fa3f`).
Expand Down Expand Up @@ -908,7 +908,7 @@ Features
* Dynamically add classes that are "registered" by contructor functions
to the top-level namespace (:commit:`4382a1b1`). This is consistent with
behavior of importing custom-ultraplot tickers, norms, etc. to top-level namespace.
Now e.g. ``pplt.MultipleLocator`` or ``pplt.LogNorm`` are allowed.
Now e.g. ``uplt.MultipleLocator`` or ``uplt.LogNorm`` are allowed.
* Allow creating subplots with `~ultraplot.ui.figure` and either (1) subsequently
calling `~ultraplot.figure.Fiugure.subplots` or (2) passing integers or subplot specs
generated by `~ultraplot.gridspec.GridSpec` to `~ultraplot.figure.Figure.add_subplot`
Expand Down Expand Up @@ -951,7 +951,7 @@ Features
geometry by looking up subplotspec indices (:commit:`51967ce3`). Previously 2d
indexing of ``SubplotGrid`` with complex geometry would just return a wrong result.
* Issue warning message when users try ``fig.subplots_adjust()`` or
``pplt.figure(subplotpars=SubplotParams)`` and auto-disable and warn when
``uplt.figure(subplotpars=SubplotParams)`` and auto-disable and warn when
matplotlib "tight layout" rc settings are toggled (:commit:`51967ce3`).
* Add nicer string representations of figures, gridspecs, subplotspecs, and
axes clearly showing the geometry and layout (:commit:`51967ce3`, :commit:`6382cf91`).
Expand Down Expand Up @@ -1013,7 +1013,7 @@ Features
* Make `~ultraplot.config.rc_ultraplot` and `~ultraplot.config.rc_matplotlib` containers
of ultraplot/matplotlib settings part of the public API (:commit:`a50d5264`).
* Allow conversion of numeric inputs with `~ultraplot.utils.units` using e.g.
``pplt.units(num, 'in', 'cm')`` (:commit:`88f3dc88`).
``uplt.units(num, 'in', 'cm')`` (:commit:`88f3dc88`).
* Add more intuitive :rcraw:`grid.labelpad` and :rcraw:`tick.labelpad`
as aliases for :rcraw:`grid.pad` and :rcraw:`tick.pad` (:commit:`a50d5264`).
* Add `~ultraplot.axes.PlotAxes.line` and `~ultraplot.axes.PlotAxes.linex` command
Expand Down Expand Up @@ -1484,7 +1484,7 @@ Internals
Documentation
-------------

* Finally use ``pplt`` as the recommended abbreviation: ``import ultraplot as pplt``.
* Finally use ``uplt`` as the recommended abbreviation: ``import ultraplot as uplt``.
* Major clean up of "Why ultraplot?" page and user guide pages.
* Fix incomplete ``cmap.from_file`` docstrings (:commit:`54f1bc7c`).
* Rename "Changelog" to "What's New?" and list all contributors in "About the Authors".
Expand Down
78 changes: 39 additions & 39 deletions docs/1dplots.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,16 @@
# the :rcraw:`cmap.inbounds` setting and the :ref:`user guide <ug_2dstd>`).

# %%
import ultraplot as pplt
import ultraplot as uplt
import numpy as np

N = 5
state = np.random.RandomState(51423)
with pplt.rc.context({"axes.prop_cycle": pplt.Cycle("Grays", N=N, left=0.3)}):
with uplt.rc.context({"axes.prop_cycle": uplt.Cycle("Grays", N=N, left=0.3)}):
# Sample data
x = np.linspace(-5, 5, N)
y = state.rand(N, 5)
fig = pplt.figure(share=False, suptitle="Standardized input demonstration")
fig = uplt.figure(share=False, suptitle="Standardized input demonstration")

# Plot by passing both x and y coordinates
ax = fig.subplot(121, title="Manual x coordinates")
Expand All @@ -92,26 +92,26 @@
fig.format(xlabel="xlabel", ylabel="ylabel")

# %%
import ultraplot as pplt
import ultraplot as uplt
import numpy as np

# Sample data
cycle = pplt.Cycle("davos", right=0.8)
cycle = uplt.Cycle("davos", right=0.8)
state = np.random.RandomState(51423)
N, M = 400, 20
xmax = 20
x = np.linspace(0, 100, N)
y = 100 * (state.rand(N, M) - 0.42).cumsum(axis=0)

# Plot the data
fig = pplt.figure(refwidth=2.2, share=False)
fig = uplt.figure(refwidth=2.2, share=False)
axs = fig.subplots([[0, 1, 1, 0], [2, 2, 3, 3]], wratios=(2, 1, 1, 2))
axs[0].axvspan(
0,
xmax,
zorder=3,
edgecolor="red",
facecolor=pplt.set_alpha("red", 0.2),
facecolor=uplt.set_alpha("red", 0.2),
)
for i, ax in enumerate(axs):
inbounds = i == 1
Expand Down Expand Up @@ -191,17 +191,17 @@
df.columns.name = "category"

# %%
import ultraplot as pplt
import ultraplot as uplt

fig = pplt.figure(share=False, suptitle="Automatic subplot formatting")
fig = uplt.figure(share=False, suptitle="Automatic subplot formatting")

# Plot DataArray
cycle = pplt.Cycle("dark blue", space="hpl", N=da.shape[1])
cycle = uplt.Cycle("dark blue", space="hpl", N=da.shape[1])
ax = fig.subplot(121)
ax.scatter(da, cycle=cycle, lw=3, colorbar="t", colorbar_kw={"locator": 20})

# Plot Dataframe
cycle = pplt.Cycle("dark green", space="hpl", N=df.shape[1])
cycle = uplt.Cycle("dark green", space="hpl", N=df.shape[1])
ax = fig.subplot(122)
ax.plot(df, cycle=cycle, lw=3, legend="t", legend_kw={"frame": False})

Expand Down Expand Up @@ -230,7 +230,7 @@
# <https://matplotlib.org/stable/tutorials/intermediate/color_cycle.html#sphx-glr-tutorials-intermediate-color-cycle-py>`__.

# %%
import ultraplot as pplt
import ultraplot as uplt
import numpy as np

# Sample data
Expand All @@ -241,9 +241,9 @@
data1 += state.rand(M, N)
data2 += state.rand(M, N)

with pplt.rc.context({"lines.linewidth": 3}):
with uplt.rc.context({"lines.linewidth": 3}):
# Use property cycle for columns of 2D input data
fig = pplt.figure(share=False)
fig = uplt.figure(share=False)
ax = fig.subplot(121, title="Single plot call")
ax.plot(
2 * data1 + data2,
Expand Down Expand Up @@ -283,12 +283,12 @@
# "positive" lines using ``negpos=True`` (see :ref:`below <ug_negpos>` for details).

# %%
import ultraplot as pplt
import ultraplot as uplt
import numpy as np

state = np.random.RandomState(51423)
gs = pplt.GridSpec(nrows=3, ncols=2)
fig = pplt.figure(refwidth=2.2, span=False, share="labels")
gs = uplt.GridSpec(nrows=3, ncols=2)
fig = uplt.figure(refwidth=2.2, span=False, share="labels")

# Vertical vs. horizontal
data = (state.rand(10, 5) - 0.5).cumsum(axis=0)
Expand Down Expand Up @@ -359,7 +359,7 @@
# calls `~ultraplot.axes.Axes.scatter` internally.

# %%
import ultraplot as pplt
import ultraplot as uplt
import numpy as np
import pandas as pd

Expand All @@ -370,8 +370,8 @@
data = pd.DataFrame(data, columns=pd.Index(["a", "b", "c", "d"], name="label"))

# Figure
gs = pplt.GridSpec(ncols=2, nrows=2)
fig = pplt.figure(refwidth=2.2, share="labels", span=False)
gs = uplt.GridSpec(ncols=2, nrows=2)
fig = uplt.figure(refwidth=2.2, share="labels", span=False)

# Vertical vs. horizontal
ax = fig.subplot(gs[0], title="Dependent x-axis")
Expand Down Expand Up @@ -423,12 +423,12 @@
# plot with a colorbar indicating the parametric coordinate.

# %%
import ultraplot as pplt
import ultraplot as uplt
import numpy as np
import pandas as pd

gs = pplt.GridSpec(ncols=2, wratios=(2, 1))
fig = pplt.figure(figwidth="16cm", refaspect=(2, 1), share=False)
gs = uplt.GridSpec(ncols=2, wratios=(2, 1))
fig = uplt.figure(figwidth="16cm", refaspect=(2, 1), share=False)
fig.format(suptitle="Parametric plots demo")
cmap = "IceFire"

Expand Down Expand Up @@ -518,7 +518,7 @@
# `~ultraplot.axes.Axes.bar` or `~ultraplot.axes.Axes.barh` internally.

# %%
import ultraplot as pplt
import ultraplot as uplt
import numpy as np
import pandas as pd

Expand All @@ -532,10 +532,10 @@
)

# Figure
pplt.rc.abc = "a."
pplt.rc.titleloc = "l"
gs = pplt.GridSpec(nrows=2, hratios=(3, 2))
fig = pplt.figure(refaspect=2, refwidth=4.8, share=False)
uplt.rc.abc = "a."
uplt.rc.titleloc = "l"
gs = uplt.GridSpec(nrows=2, hratios=(3, 2))
fig = uplt.figure(refaspect=2, refwidth=4.8, share=False)

# Side-by-side bars
ax = fig.subplot(gs[0], title="Side-by-side")
Expand All @@ -554,10 +554,10 @@
stack=True,
)
fig.format(grid=False, suptitle="Bar plot demo")
pplt.rc.reset()
uplt.rc.reset()

# %%
import ultraplot as pplt
import ultraplot as uplt
import numpy as np

# Sample data
Expand All @@ -566,9 +566,9 @@
cycle = ("gray3", "gray5", "gray7")

# Figure
pplt.rc.abc = "a."
pplt.rc.titleloc = "l"
fig = pplt.figure(refwidth=2.3, share=False)
uplt.rc.abc = "a."
uplt.rc.titleloc = "l"
fig = uplt.figure(refwidth=2.3, share=False)

# Overlaid area patches
ax = fig.subplot(121, title="Fill between columns")
Expand All @@ -594,7 +594,7 @@
legend_kw={"center": True, "ncols": 2, "labels": ["z", "y", "qqqq"]},
)
fig.format(grid=False, xlabel="xlabel", ylabel="ylabel", suptitle="Area plot demo")
pplt.rc.reset()
uplt.rc.reset()

# %% [raw] raw_mimetype="text/restructuredtext"
# .. _ug_negpos:
Expand All @@ -613,17 +613,17 @@
# ``negcolor=color`` and ``poscolor=color`` to the `~ultraplot.axes.PlotAxes` commands.

# %%
import ultraplot as pplt
import ultraplot as uplt
import numpy as np

# Sample data
state = np.random.RandomState(51423)
data = 4 * (state.rand(40) - 0.5)

# Figure
pplt.rc.abc = "a."
pplt.rc.titleloc = "l"
fig, axs = pplt.subplots(nrows=3, refaspect=2, figwidth=5)
uplt.rc.abc = "a."
uplt.rc.titleloc = "l"
fig, axs = uplt.subplots(nrows=3, refaspect=2, figwidth=5)
axs.format(
xmargin=0,
xlabel="xlabel",
Expand All @@ -650,4 +650,4 @@
ax.format(title="Area plot")

# Reset title styles changed above
pplt.rc.reset()
uplt.rc.reset()
Loading