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
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ test = [
"coverage[toml]>=7.0.0",
"typeguard>=4.4.0",
"pandas",
"astropy"
]
dev = [
"tox",
Expand Down
11 changes: 11 additions & 0 deletions requirements-310.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# This file was autogenerated by uv via the following command:
# uv pip compile pyproject.toml --extra test --resolution highest --python 3.10 -o requirements-310.txt
astropy==6.1.7
# via matplot2tikz (pyproject.toml)
astropy-iers-data==0.2026.2.2.0.48.1
# via astropy
colorama==0.4.6
# via pytest
contourpy==1.3.2
Expand All @@ -23,11 +27,14 @@ matplotlib==3.10.7
numpy==2.2.6
# via
# matplot2tikz (pyproject.toml)
# astropy
# contourpy
# matplotlib
# pandas
# pyerfa
packaging==25.0
# via
# astropy
# matplotlib
# pytest
pandas==2.3.3
Expand All @@ -40,6 +47,8 @@ pluggy==1.6.0
# via
# pytest
# pytest-cov
pyerfa==2.0.1.5
# via astropy
pygments==2.19.2
# via pytest
pyparsing==3.2.5
Expand All @@ -56,6 +65,8 @@ python-dateutil==2.9.0.post0
# pandas
pytz==2025.2
# via pandas
pyyaml==6.0.3
# via astropy
six==1.17.0
# via python-dateutil
tomli==2.3.0
Expand Down
11 changes: 11 additions & 0 deletions requirements-311.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# This file was autogenerated by uv via the following command:
# uv pip compile pyproject.toml --extra test --resolution highest --python 3.11 -o requirements-311.txt
astropy==7.2.0
# via matplot2tikz (pyproject.toml)
astropy-iers-data==0.2026.2.2.0.48.1
# via astropy
colorama==0.4.6
# via pytest
contourpy==1.3.3
Expand All @@ -21,11 +25,14 @@ matplotlib==3.10.7
numpy==2.3.4
# via
# matplot2tikz (pyproject.toml)
# astropy
# contourpy
# matplotlib
# pandas
# pyerfa
packaging==25.0
# via
# astropy
# matplotlib
# pytest
pandas==2.3.3
Expand All @@ -38,6 +45,8 @@ pluggy==1.6.0
# via
# pytest
# pytest-cov
pyerfa==2.0.1.5
# via astropy
pygments==2.19.2
# via pytest
pyparsing==3.2.5
Expand All @@ -54,6 +63,8 @@ python-dateutil==2.9.0.post0
# pandas
pytz==2025.2
# via pandas
pyyaml==6.0.3
# via astropy
six==1.17.0
# via python-dateutil
tomli==2.3.0
Expand Down
11 changes: 11 additions & 0 deletions requirements-312.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# This file was autogenerated by uv via the following command:
# uv pip compile pyproject.toml --extra test --resolution highest --python 3.12 -o requirements-312.txt
astropy==7.2.0
# via matplot2tikz (pyproject.toml)
astropy-iers-data==0.2026.2.2.0.48.1
# via astropy
colorama==0.4.6
# via pytest
contourpy==1.3.3
Expand All @@ -21,11 +25,14 @@ matplotlib==3.10.7
numpy==2.3.4
# via
# matplot2tikz (pyproject.toml)
# astropy
# contourpy
# matplotlib
# pandas
# pyerfa
packaging==25.0
# via
# astropy
# matplotlib
# pytest
pandas==2.3.3
Expand All @@ -38,6 +45,8 @@ pluggy==1.6.0
# via
# pytest
# pytest-cov
pyerfa==2.0.1.5
# via astropy
pygments==2.19.2
# via pytest
pyparsing==3.2.5
Expand All @@ -54,6 +63,8 @@ python-dateutil==2.9.0.post0
# pandas
pytz==2025.2
# via pandas
pyyaml==6.0.3
# via astropy
six==1.17.0
# via python-dateutil
typeguard==4.4.4
Expand Down
11 changes: 11 additions & 0 deletions requirements-313.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# This file was autogenerated by uv via the following command:
# uv pip compile pyproject.toml --extra test --resolution highest --python 3.13 -o requirements-313.txt
astropy==7.2.0
# via matplot2tikz (pyproject.toml)
astropy-iers-data==0.2026.2.2.0.48.1
# via astropy
colorama==0.4.6
# via pytest
contourpy==1.3.3
Expand All @@ -21,11 +25,14 @@ matplotlib==3.10.7
numpy==2.3.4
# via
# matplot2tikz (pyproject.toml)
# astropy
# contourpy
# matplotlib
# pandas
# pyerfa
packaging==25.0
# via
# astropy
# matplotlib
# pytest
pandas==2.3.3
Expand All @@ -38,6 +45,8 @@ pluggy==1.6.0
# via
# pytest
# pytest-cov
pyerfa==2.0.1.5
# via astropy
pygments==2.19.2
# via pytest
pyparsing==3.2.5
Expand All @@ -54,6 +63,8 @@ python-dateutil==2.9.0.post0
# pandas
pytz==2025.2
# via pandas
pyyaml==6.0.3
# via astropy
six==1.17.0
# via python-dateutil
typeguard==4.4.4
Expand Down
11 changes: 11 additions & 0 deletions requirements-314.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# This file was autogenerated by uv via the following command:
# uv pip compile pyproject.toml --extra test --resolution highest --python 3.14 -o requirements-314.txt
astropy==7.2.0
# via matplot2tikz (pyproject.toml)
astropy-iers-data==0.2026.2.2.0.48.1
# via astropy
colorama==0.4.6
# via pytest
contourpy==1.3.3
Expand All @@ -21,11 +25,14 @@ matplotlib==3.10.7
numpy==2.3.4
# via
# matplot2tikz (pyproject.toml)
# astropy
# contourpy
# matplotlib
# pandas
# pyerfa
packaging==25.0
# via
# astropy
# matplotlib
# pytest
pandas==2.3.3
Expand All @@ -38,6 +45,8 @@ pluggy==1.6.0
# via
# pytest
# pytest-cov
pyerfa==2.0.1.5
# via astropy
pygments==2.19.2
# via pytest
pyparsing==3.2.5
Expand All @@ -54,6 +63,8 @@ python-dateutil==2.9.0.post0
# pandas
pytz==2025.2
# via pandas
pyyaml==6.0.3
# via astropy
six==1.17.0
# via python-dateutil
typeguard==4.4.4
Expand Down
2 changes: 1 addition & 1 deletion src/matplot2tikz/__about__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""Version number."""

__version__ = "0.5.1"
__version__ = "0.5.2"
4 changes: 4 additions & 0 deletions src/matplot2tikz/_save.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,10 @@ def _recurse(data: TikzData, obj: Artist) -> list:
if isinstance(child, (Spine, XAxis, YAxis)):
continue

# Skip WCS axes artist - it's a placeholder with no visible content
if type(child).__name__ == "_WCSAxesArtist":
continue

if isinstance(child, Axes):
_process_axes(data, child, content)

Expand Down
62 changes: 62 additions & 0 deletions tests/test_wcs_axes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
"""Test plot with WCS axes."""

import warnings

import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
from astropy.wcs import WCS

import matplot2tikz

mpl.use("Agg")


def test_wcs_axes() -> None:
"""Test that WCS axes are handled without warnings."""
# Create a simple WCS
wcs = WCS(naxis=2)
wcs.wcs.crpix = [50, 50]
wcs.wcs.cdelt = [0.1, 0.1]
wcs.wcs.crval = [0, -90]
wcs.wcs.ctype = ["RA---TAN", "DEC--TAN"]

# Create a figure with WCS projection
fig, ax = plt.subplots(subplot_kw={"projection": wcs})

# Add some data
rng = np.random.default_rng(1337)
data = rng.integers(5, size=(2, 4))
vmin = data.min()
vmax = data.max()
mappable = ax.imshow(data, vmin=vmin, vmax=vmax, origin="lower", cmap="viridis")
ax.grid(color="white", ls="solid", alpha=0.5)
ax.set(xlabel="Galactic Longitude", ylabel="Galactic Latitude")
_ = fig.colorbar(mappable, ax=ax, label="Test Unit")

with warnings.catch_warnings(record=True) as w:
warnings.simplefilter("always")
tikz_code = matplot2tikz.get_tikz_code()

# Filter warnings to only check for the specific warning about unknown objects
unknown_object_warnings = [
warning
for warning in w
if issubclass(warning.category, UserWarning)
and "Don't know how to handle object" in str(warning.message)
and "_WCSAxesArtist" in str(warning.message)
]

# Assert that we didn't get the _WCSAxesArtist warning
assert len(unknown_object_warnings) == 0, (
f"Got unexpected warning about _WCSAxesArtist: "
f"{[str(warning.message) for warning in unknown_object_warnings]}"
)

# Basic checks that the output looks reasonable
assert "\\begin{tikzpicture}" in tikz_code
assert "\\end{tikzpicture}" in tikz_code
# Check that image is included
assert "\\addplot graphics" in tikz_code

plt.close("all")