Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
3acd648
Bump the github-actions group with 2 updates (#398)
dependabot[bot] Nov 1, 2025
4b438aa
add s and unittest (#400)
cvanelteren Nov 2, 2025
84b0c6c
redo with new ticker (#411)
cvanelteren Nov 16, 2025
fa01291
Hotfix: bar labels cause limit to reset for unaffected axis. (#413)
cvanelteren Nov 18, 2025
cad96d0
fix: change default `reduce_C_function` to `np.sum` for `hexbin` (#408)
beckermr Nov 19, 2025
477e187
Add external context mode for axes (#406)
cvanelteren Nov 20, 2025
9960530
Bump actions/checkout from 5 to 6 in the github-actions group (#415)
dependabot[bot] Dec 1, 2025
a9db8bc
[pre-commit.ci] pre-commit autoupdate (#416)
pre-commit-ci[bot] Dec 1, 2025
2405218
Add placement of legend to axes within a figure (#418)
cvanelteren Dec 7, 2025
bcc0aaa
There's a typo about zerotrim in doc. (#420)
gepcel Dec 8, 2025
f8fb44b
Fix references in documentation for clarity (#421)
gepcel Dec 10, 2025
8e2973d
fix links to apply_norm (#423)
cvanelteren Dec 11, 2025
abcfb19
[Feature] add lon lat labelrotation (#426)
cvanelteren Dec 12, 2025
edd6039
fix boundary check for ticks
cvanelteren Dec 13, 2025
1002adf
Revert "fix boundary check for ticks"
cvanelteren Dec 13, 2025
d3f8342
Fix: Boundary labels now visible when setting lonlim/latlim (#429)
cvanelteren Dec 15, 2025
80e12ee
Add Copernicus Publications figure standard widths. (#433)
Holmgren825 Dec 16, 2025
6e0f5c1
Fix unequal slicing for Gridspec (#435)
cvanelteren Dec 17, 2025
0a4c033
Fix GeoAxes panel alignment with aspect-constrained projections (#432)
cvanelteren Dec 29, 2025
46d7a8b
Bump the github-actions group with 2 updates (#444)
dependabot[bot] Jan 1, 2026
e64456f
Fix dualx alignment on log axes (#443)
cvanelteren Jan 4, 2026
fb45153
Subset label sharing and implicit slice labels for axis groups (#440)
cvanelteren Jan 4, 2026
5895f8a
Preserve log formatter when setting log scales (#437)
cvanelteren Jan 4, 2026
f55a7a9
Shrink title to avoid abc overlap
cvanelteren Dec 31, 2025
0df473f
Skip title auto-scaling when fontsize is set
cvanelteren Dec 31, 2025
9d9317e
Fix title overlap tests and zero-size axes draw
cvanelteren Jan 1, 2026
b3670a7
Shrink titles when abc overlaps across locations
cvanelteren Jan 1, 2026
d68a9dd
update tests
cvanelteren Jan 4, 2026
7e2c0a9
add tests
cvanelteren Jan 4, 2026
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
6 changes: 3 additions & 3 deletions .github/workflows/build-ultraplot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
run:
shell: bash -el {0}
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
fetch-depth: 0

Expand Down Expand Up @@ -58,7 +58,7 @@ jobs:
run:
shell: bash -el {0}
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6

- uses: mamba-org/setup-micromamba@v2.0.7
with:
Expand Down Expand Up @@ -98,7 +98,7 @@ jobs:
# Return the html output of the comparison even if failed
- name: Upload comparison failures
if: always()
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v6
with:
name: failed-comparisons-${{ inputs.python-version }}-${{ inputs.matplotlib-version }}-${{ github.sha }}
path: results/*
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
outputs:
run: ${{ (github.event_name == 'push' && github.ref_name == 'main') && 'true' || steps.filter.outputs.python }}
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
- uses: dorny/paths-filter@v3
id: filter
with:
Expand All @@ -28,7 +28,7 @@ jobs:
python-versions: ${{ steps.set-versions.outputs.python-versions }}
matplotlib-versions: ${{ steps.set-versions.outputs.matplotlib-versions }}
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
fetch-depth: 0

Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/publish-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
name: Build packages
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
fetch-depth: 0

Expand Down Expand Up @@ -54,7 +54,7 @@ jobs:
shell: bash

- name: Upload artifacts
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v6
with:
name: dist-${{ github.sha }}-${{ github.run_id }}-${{ github.run_number }}
path: dist/*
Expand All @@ -73,7 +73,7 @@ jobs:
contents: read
steps:
- name: Download artifacts
uses: actions/download-artifact@v5
uses: actions/download-artifact@v7
with:
name: dist-${{ github.sha }}-${{ github.run_id }}-${{ github.run_number }}
path: dist
Expand Down Expand Up @@ -105,7 +105,7 @@ jobs:
contents: read
steps:
- name: Download artifacts
uses: actions/download-artifact@v5
uses: actions/download-artifact@v7
with:
name: dist-${{ github.sha }}-${{ github.run_id }}-${{ github.run_number }}
path: dist
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ ci:

repos:
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 25.9.0
rev: 25.11.0
hooks:
- id: black
48 changes: 30 additions & 18 deletions docs/2dplots.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,10 @@
# setting and the :ref:`user guide <ug_1dstd>`).

# %%
import ultraplot as uplt
import numpy as np

import ultraplot as uplt

# Sample data
state = np.random.RandomState(51423)
x = y = np.array([-10, -5, 0, 5, 10])
Expand Down Expand Up @@ -110,9 +111,10 @@
axs[3].contourf(xedges, yedges, data)

# %%
import ultraplot as uplt
import numpy as np

import ultraplot as uplt

# Sample data
cmap = "turku_r"
state = np.random.RandomState(51423)
Expand Down Expand Up @@ -184,9 +186,9 @@
# `~pint.UnitRegistry.setup_matplotlib` so that the axes become unit-aware.

# %%
import xarray as xr
import numpy as np
import pandas as pd
import xarray as xr

# DataArray
state = np.random.RandomState(51423)
Expand Down Expand Up @@ -261,13 +263,14 @@
# ``diverging=True``, ``cyclic=True``, or ``qualitative=True`` to any plotting
# command. If the colormap type is not explicitly specified, `sequential` is
# used with the default linear normalizer when data is strictly positive
# or negative, and `diverging` is used with the :ref:`diverging normalizer <ug_norm>`
# or negative, and `diverging` is used with the :ref:`diverging normalizer <ug_apply_norm>`
# when the data limits or colormap levels cross zero (see :ref:`below <ug_autonorm>`).

# %%
import ultraplot as uplt
import numpy as np

import ultraplot as uplt

# Sample data
N = 18
state = np.random.RandomState(51423)
Expand All @@ -294,9 +297,10 @@
uplt.rc.reset()

# %%
import ultraplot as uplt
import numpy as np

import ultraplot as uplt

# Sample data
N = 20
state = np.random.RandomState(51423)
Expand All @@ -322,9 +326,10 @@
colorbar="b",
)

import ultraplot as uplt
import numpy as np

import ultraplot as uplt

# Sample data
N = 20
state = np.random.RandomState(51423)
Expand All @@ -347,7 +352,7 @@
# Special normalizers
# -------------------
#
# UltraPlot includes two new :ref:`"continuous" normalizers <ug_norm>`. The
# UltraPlot includes two new :ref:`"continuous" normalizers <ug_apply_norm>`. The
# `~ultraplot.colors.SegmentedNorm` normalizer provides even color gradations with respect
# to index for an arbitrary monotonically increasing or decreasing list of levels. This
# is automatically applied if you pass unevenly spaced `levels` to a plotting command,
Expand All @@ -372,9 +377,10 @@
# affect the interpretation of different datasets.

# %%
import ultraplot as uplt
import numpy as np

import ultraplot as uplt

# Sample data
state = np.random.RandomState(51423)
data = 11 ** (2 * state.rand(20, 20).cumsum(axis=0) / 7)
Expand All @@ -395,9 +401,10 @@
)
ax.format(title=norm.title() + " normalizer")
# %%
import ultraplot as uplt
import numpy as np

import ultraplot as uplt

# Sample data
state = np.random.RandomState(51423)
data1 = (state.rand(20, 20) - 0.485).cumsum(axis=1).cumsum(axis=0)
Expand Down Expand Up @@ -434,7 +441,7 @@
# commands (e.g., :func:`~ultraplot.axes.PlotAxes.contourf`, :func:`~ultraplot.axes.PlotAxes.pcolor`).
# This is analogous to `matplotlib.colors.BoundaryNorm`, except
# `~ultraplot.colors.DiscreteNorm` can be paired with arbitrary
# continuous normalizers specified by `norm` (see :ref:`above <ug_norm>`).
# continuous normalizers specified by `norm` (see :ref:`above <ug_apply_norm>`).
# Discrete color levels can help readers discern exact numeric values and
# tend to reveal qualitative structure in the data. `~ultraplot.colors.DiscreteNorm`
# also repairs the colormap end-colors by ensuring the following conditions are met:
Expand Down Expand Up @@ -463,9 +470,10 @@
# the zero level (useful for single-color :func:`~ultraplot.axes.PlotAxes.contour` plots).

# %%
import ultraplot as uplt
import numpy as np

import ultraplot as uplt

# Sample data
state = np.random.RandomState(51423)
data = 10 + state.normal(0, 1, size=(33, 33)).cumsum(axis=0).cumsum(axis=1)
Expand All @@ -485,9 +493,10 @@
axs[2].format(title="Imshow plot\ndiscrete=False (default)", yformatter="auto")

# %%
import ultraplot as uplt
import numpy as np

import ultraplot as uplt

# Sample data
state = np.random.RandomState(51423)
data = (20 * (state.rand(20, 20) - 0.4).cumsum(axis=0).cumsum(axis=1)) % 360
Expand Down Expand Up @@ -547,7 +556,7 @@
# the 2D :class:`~ultraplot.axes.PlotAxes` commands will apply the diverging colormap
# :rc:`cmap.diverging` (rather than :rc:`cmap.sequential`) and the diverging
# normalizer `~ultraplot.colors.DivergingNorm` (rather than :class:`~matplotlib.colors.Normalize`
# -- see :ref:`above <ug_norm>`) if the following conditions are met:
# -- see :ref:`above <ug_apply_norm>`) if the following conditions are met:
#
# #. If discrete levels are enabled (see :ref:`above <ug_discrete>`) and the
# level list includes at least 2 negative and 2 positive values.
Expand All @@ -560,9 +569,10 @@
# setting :rcraw:`cmap.autodiverging` to ``False``.

# %%
import ultraplot as uplt
import numpy as np

import ultraplot as uplt

N = 20
state = np.random.RandomState(51423)
data = N * 2 + (state.rand(N, N) - 0.45).cumsum(axis=0).cumsum(axis=1) * 10
Expand Down Expand Up @@ -605,9 +615,10 @@
# command documentation for details.

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

import ultraplot as uplt

# Sample data
state = np.random.RandomState(51423)
Expand Down Expand Up @@ -663,10 +674,11 @@
# `~ultraplot.axes.CartesianAxes`.

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

import ultraplot as uplt

# Covariance data
state = np.random.RandomState(51423)
data = state.normal(size=(10, 10)).cumsum(axis=0)
Expand Down
20 changes: 13 additions & 7 deletions docs/colorbars_legends.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,10 @@
# complex arrangements of subplots, colorbars, and legends.

# %%
import ultraplot as uplt
import numpy as np

import ultraplot as uplt

state = np.random.RandomState(51423)
fig = uplt.figure(share=False, refwidth=2.3)

Expand Down Expand Up @@ -183,9 +184,10 @@
)

# %%
import ultraplot as uplt
import numpy as np

import ultraplot as uplt

N = 10
state = np.random.RandomState(51423)
fig, axs = uplt.subplots(
Expand Down Expand Up @@ -232,9 +234,10 @@
# and the tight layout padding can be controlled with the `pad` keyword.

# %%
import ultraplot as uplt
import numpy as np

import ultraplot as uplt

state = np.random.RandomState(51423)
fig, axs = uplt.subplots(ncols=3, nrows=3, refwidth=1.4)
for ax in axs:
Expand All @@ -254,9 +257,10 @@
fig.colorbar(m, label="colorbar with length <1", ticks=0.1, loc="r", length=0.7)

# %%
import ultraplot as uplt
import numpy as np

import ultraplot as uplt

state = np.random.RandomState(51423)
fig, axs = uplt.subplots(
ncols=2, nrows=2, order="F", refwidth=1.7, wspace=2.5, share=False
Expand Down Expand Up @@ -299,7 +303,7 @@
# will build the required `~matplotlib.cm.ScalarMappable` on-the-fly. Lists
# of :class:`~matplotlib.artist.Artists`\ s are used when you use the `colorbar`
# keyword with :ref:`1D commands <ug_1dplots>` like :func:`~ultraplot.axes.PlotAxes.plot`.
# * The associated :ref:`colormap normalizer <ug_norm>` can be specified with the
# * The associated :ref:`colormap normalizer <ug_apply_norm>` can be specified with the
# `vmin`, `vmax`, `norm`, and `norm_kw` keywords. The `~ultraplot.colors.DiscreteNorm`
# levels can be specified with `values`, or UltraPlot will infer them from the
# :class:`~matplotlib.artist.Artist` labels (non-numeric labels will be applied to
Expand Down Expand Up @@ -332,9 +336,10 @@
# See :func:`~ultraplot.axes.Axes.colorbar` for details.

# %%
import ultraplot as uplt
import numpy as np

import ultraplot as uplt

fig = uplt.figure(share=False, refwidth=2)

# Colorbars from lines
Expand Down Expand Up @@ -427,9 +432,10 @@
# (or use the `handle_kw` keyword). See `ultraplot.axes.Axes.legend` for details.

# %%
import ultraplot as uplt
import numpy as np

import ultraplot as uplt

uplt.rc.cycle = "538"
fig, axs = uplt.subplots(ncols=2, span=False, share="labels", refwidth=2.3)
labels = ["a", "bb", "ccc", "dddd", "eeeee"]
Expand Down
6 changes: 3 additions & 3 deletions docs/why.rst
Original file line number Diff line number Diff line change
Expand Up @@ -499,9 +499,9 @@ like :func:`~ultraplot.axes.PlotAxes.pcolor` and :func:`~ultraplot.axes.PlotAxes
plots. This can be disabled by setting :rcraw:`cmap.discrete` to ``False`` or
by passing ``discrete=False`` to :class:`~ultraplot.axes.PlotAxes` commands.
* The :class:`~ultraplot.colors.DivergingNorm` normalizer is perfect for data with a
:ref:`natural midpoint <ug_norm>` and offers both "fair" and "unfair" scaling.
:ref:`natural midpoint <ug_apply_norm>` and offers both "fair" and "unfair" scaling.
The :class:`~ultraplot.colors.SegmentedNorm` normalizer can generate
uneven color gradations useful for :ref:`unusual data distributions <ug_norm>`.
uneven color gradations useful for :ref:`unusual data distributions <ug_apply_norm>`.
* The :func:`~ultraplot.axes.PlotAxes.heatmap` command invokes
:func:`~ultraplot.axes.PlotAxes.pcolormesh` then applies an `equal axes apect ratio
<https://matplotlib.org/stable/gallery/subplots_axes_and_figures/axis_equal_demo.html>`__,
Expand Down Expand Up @@ -882,7 +882,7 @@ Limitation
----------

Matplotlib :obj:`~matplotlib.rcParams` can be changed persistently by placing
`matplotlibrc` :ref:`ug_mplrc` files in the same directory as your python script.
ref:`matplotlibrc <ug_mplrc>` files in the same directory as your python script.
But it can be difficult to design and store your own colormaps and color cycles for
future use. It is also difficult to get matplotlib to use custom ``.ttf`` and
``.otf`` font files, which may be desirable when you are working on
Expand Down
Loading
Loading