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
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.12.0
rev: 26.1.0
hooks:
- id: black
1 change: 1 addition & 0 deletions docs/sphinxext/custom_roles.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"""
Custom :rc: and :rcraw: roles for rc settings.
"""

import os

from docutils import nodes
Expand Down
1 change: 1 addition & 0 deletions ultraplot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"""
A succinct matplotlib wrapper for making beautiful, publication-quality graphics.
"""

from __future__ import annotations

import sys
Expand Down
1 change: 1 addition & 0 deletions ultraplot/_lazy.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"""
Helpers for lazy attribute loading in :mod:`ultraplot`.
"""

from __future__ import annotations

import ast
Expand Down
1 change: 1 addition & 0 deletions ultraplot/axes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"""
The various axes classes used throughout ultraplot.
"""

import matplotlib.projections as mproj

from ..internals import context
Expand Down
17 changes: 9 additions & 8 deletions ultraplot/axes/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
The first-level axes subclass used for all ultraplot figures.
Implements basic shared functionality.
"""

import copy
import inspect
import re
Expand Down Expand Up @@ -4191,8 +4192,8 @@ def _measure_text_overhang_axes(
renderer = axes.figure._get_renderer()
bbox = text.get_window_extent(renderer=renderer)
inv = axes.transAxes.inverted()
(x0, y0) = inv.transform((bbox.x0, bbox.y0))
(x1, y1) = inv.transform((bbox.x1, bbox.y1))
x0, y0 = inv.transform((bbox.x0, bbox.y0))
x1, y1 = inv.transform((bbox.x1, bbox.y1))
except Exception:
return None
left = max(0.0, -x0)
Expand All @@ -4218,8 +4219,8 @@ def _measure_ticklabel_overhang_axes(
if not label.get_visible() or not label.get_text():
continue
bbox = label.get_window_extent(renderer=renderer)
(x0, y0) = inv.transform((bbox.x0, bbox.y0))
(x1, y1) = inv.transform((bbox.x1, bbox.y1))
x0, y0 = inv.transform((bbox.x0, bbox.y0))
x1, y1 = inv.transform((bbox.x1, bbox.y1))
min_x = min(min_x, x0)
max_x = max(max_x, x1)
min_y = min(min_y, y0)
Expand Down Expand Up @@ -4595,11 +4596,11 @@ def _reflow_inset_colorbar_frame(
x1 = max(b.x1 for b in bboxes)
y1 = max(b.y1 for b in bboxes)
inv_parent = parent.transAxes.inverted()
(px0, py0) = inv_parent.transform((x0, y0))
(px1, py1) = inv_parent.transform((x1, y1))
px0, py0 = inv_parent.transform((x0, y0))
px1, py1 = inv_parent.transform((x1, y1))
cax_bbox = cax.get_window_extent(renderer=renderer)
(cx0, cy0) = inv_parent.transform((cax_bbox.x0, cax_bbox.y0))
(cx1, cy1) = inv_parent.transform((cax_bbox.x1, cax_bbox.y1))
cx0, cy0 = inv_parent.transform((cax_bbox.x0, cax_bbox.y0))
cx1, cy1 = inv_parent.transform((cax_bbox.x1, cax_bbox.y1))
px0, px1 = sorted((px0, px1))
py0, py1 = sorted((py0, py1))
cx0, cx1 = sorted((cx0, cx1))
Expand Down
1 change: 1 addition & 0 deletions ultraplot/axes/cartesian.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"""
The standard Cartesian axes used for most ultraplot figures.
"""

import copy
import inspect
from dataclasses import dataclass, field
Expand Down
1 change: 1 addition & 0 deletions ultraplot/axes/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
around external axes classes, allowing them to be used within ultraplot's
figure system while maintaining their native functionality.
"""

import matplotlib.axes as maxes
import matplotlib.transforms as mtransforms
from matplotlib import cbook, container
Expand Down
1 change: 1 addition & 0 deletions ultraplot/axes/geo.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"""
Axes filled with cartographic projections.
"""

from __future__ import annotations

import copy
Expand Down
1 change: 1 addition & 0 deletions ultraplot/axes/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
The second-level axes subclass used for all ultraplot figures.
Implements plotting method overrides.
"""

import contextlib
import inspect
import itertools
Expand Down
1 change: 1 addition & 0 deletions ultraplot/axes/plot_types/circlize.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"""
Helpers for pyCirclize-backed circular plots.
"""

from __future__ import annotations

import itertools
Expand Down
1 change: 1 addition & 0 deletions ultraplot/axes/polar.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"""
Polar axes using azimuth and radius instead of *x* and *y*.
"""

import inspect

try:
Expand Down
1 change: 1 addition & 0 deletions ultraplot/axes/shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"""
An axes used to jointly format Cartesian and polar axes.
"""

# NOTE: We could define these in base.py but idea is projection-specific formatters
# should never be defined on the base class. Might add to this class later anyway.
import numpy as np
Expand Down
1 change: 1 addition & 0 deletions ultraplot/axes/three.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"""
The "3D" axes class.
"""

from . import base, shared

try:
Expand Down
1 change: 1 addition & 0 deletions ultraplot/colors.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"""
Various colormap classes and colormap normalization classes.
"""

# NOTE: To avoid name conflicts between registered colormaps and colors, print
# set(uplt.colors._cmap_database) & set(uplt.colors._color_database) whenever
# you add new colormaps. v0.8 result is {'gray', 'marine', 'ocean', 'pink'} due
Expand Down
1 change: 1 addition & 0 deletions ultraplot/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Tools for setting up ultraplot and configuring global settings.
See the :ref:`configuration guide <ug_config>` for details.
"""

# NOTE: The matplotlib analogue to this file is actually __init__.py
# but it makes more sense to have all the setup actions in a separate file
# so the namespace of the top-level module is unpolluted.
Expand Down
1 change: 1 addition & 0 deletions ultraplot/constructor.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"""
T"he constructor functions used to build class instances from simple shorthand arguments.
"""

# NOTE: These functions used to be in separate files like crs.py and
# ticker.py but makes more sense to group them together to ensure usage is
# consistent and so online documentation is easier to understand. Also in
Expand Down
1 change: 1 addition & 0 deletions ultraplot/demos.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"""
Functions for displaying colors and fonts.
"""

import os
import re

Expand Down
1 change: 1 addition & 0 deletions ultraplot/externals/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
"""
External utilities adapted for ultraplot.
"""

from . import hsluv # noqa: F401
1 change: 1 addition & 0 deletions ultraplot/externals/hsluv.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
the `HCL colorspace <https://en.wikipedia.org/wiki/HCL_color_space>`__,
and the `HSLuv system <http://www.hsluv.org/implementations/>`__.
"""

# Imports. See: https://stackoverflow.com/a/2353265/4970632
# The HLS is actually HCL
import math
Expand Down
1 change: 1 addition & 0 deletions ultraplot/figure.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"""
The figure class used for all ultraplot figures.
"""

import functools
import inspect
import os
Expand Down
1 change: 1 addition & 0 deletions ultraplot/gridspec.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"""
The gridspec and subplot grid classes used throughout ultraplot.
"""

import inspect
import itertools
import re
Expand Down
1 change: 1 addition & 0 deletions ultraplot/internals/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"""
Internal utilities.
"""

# Import statements
import inspect
from importlib import import_module
Expand Down
1 change: 1 addition & 0 deletions ultraplot/internals/benchmarks.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"""
Utilities for benchmarking ultraplot performance.
"""

import time

from . import ic # noqa: F401
Expand Down
1 change: 1 addition & 0 deletions ultraplot/internals/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"""
Utilities for manging context.
"""

from . import ic # noqa: F401


Expand Down
1 change: 1 addition & 0 deletions ultraplot/internals/docstring.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"""
Utilities for modifying ultraplot docstrings.
"""

# WARNING: To check every docstring in the package for
# unfilled snippets simply use the following code:
# >>> import ultraplot as uplt
Expand Down
1 change: 1 addition & 0 deletions ultraplot/internals/fonts.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"""
Overrides related to math fonts.
"""

import matplotlib as mpl
from matplotlib.font_manager import findfont, ttfFontProperty
from matplotlib.mathtext import MathTextParser
Expand Down
1 change: 1 addition & 0 deletions ultraplot/internals/guides.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"""
Utilties related to legends and colorbars.
"""

import matplotlib.artist as martist
import matplotlib.colorbar as mcolorbar
import matplotlib.legend as mlegend # noqa: F401
Expand Down
1 change: 1 addition & 0 deletions ultraplot/internals/inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"""
Utilities for processing input data passed to plotting commands.
"""

import functools
import sys

Expand Down
1 change: 1 addition & 0 deletions ultraplot/internals/labels.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"""
Utilities related to matplotlib text labels.
"""

import matplotlib.patheffects as mpatheffects
import matplotlib.text as mtext
from matplotlib.font_manager import FontProperties
Expand Down
1 change: 1 addition & 0 deletions ultraplot/internals/rcsetup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"""
Utilities for global configuration.
"""

import functools
import re
from collections.abc import MutableMapping
Expand Down
1 change: 1 addition & 0 deletions ultraplot/internals/versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"""
Utilities for handling dependencies and version changes.
"""

from . import ic # noqa: F401
from . import warnings

Expand Down
1 change: 1 addition & 0 deletions ultraplot/internals/warnings.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"""
Utilities for internal warnings and deprecations.
"""

import functools
import re
import sys
Expand Down
1 change: 1 addition & 0 deletions ultraplot/proj.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"""
Additional cartopy projection classes.
"""

import warnings

from .internals import ic # noqa: F401
Expand Down
1 change: 1 addition & 0 deletions ultraplot/scale.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"""
Various axis `~matplotlib.scale.ScaleBase` classes.
"""

import copy

import matplotlib.scale as mscale
Expand Down
1 change: 1 addition & 0 deletions ultraplot/tests/test_1dplots.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"""
Test 1D plotting overrides.
"""

import numpy as np
import numpy.ma as ma
import pandas as pd
Expand Down
1 change: 1 addition & 0 deletions ultraplot/tests/test_2dplots.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"""
Test 2D plotting overrides.
"""

import numpy as np
import pytest
import xarray as xr
Expand Down
1 change: 1 addition & 0 deletions ultraplot/tests/test_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"""
Test twin, inset, and panel axes.
"""

import numpy as np
import pytest

Expand Down
1 change: 1 addition & 0 deletions ultraplot/tests/test_colorbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"""
Test colorbars.
"""

import numpy as np
import pytest

Expand Down
1 change: 1 addition & 0 deletions ultraplot/tests/test_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"""
Automatically build pytests from jupytext py:percent documentation files.
"""

# import glob
# import os

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
These tests verify that the ExternalAxesContainer works correctly with
external axes like mpltern.TernaryAxes.
"""

import numpy as np
import pytest

Expand Down
1 change: 1 addition & 0 deletions ultraplot/tests/test_external_container_edge_cases.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
These tests cover error handling, edge cases, and integration scenarios
without requiring external dependencies.
"""

from unittest.mock import Mock, patch

import numpy as np
Expand Down
1 change: 1 addition & 0 deletions ultraplot/tests/test_external_container_mocked.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
These tests verify container behavior without requiring external dependencies
like mpltern to be installed.
"""

from unittest.mock import MagicMock, Mock, call, patch

import numpy as np
Expand Down
2 changes: 1 addition & 1 deletion ultraplot/tests/test_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
"""
Test format and rc behavior.
"""

import locale, numpy as np, ultraplot as uplt, pytest
import warnings


# def test_colormap_assign():
# """
# Test below line is possible and naming schemes.
Expand Down
1 change: 1 addition & 0 deletions ultraplot/tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"""
Test xarray, pandas, pint, seaborn integration.
"""

import numpy as np
import pandas as pd
import pint
Expand Down
Loading
Loading