-
Notifications
You must be signed in to change notification settings - Fork 389
Closed as not planned
Closed as not planned
Copy link
Description
Description
Crash when plotting with bbox_inches="tight" in cartopy v0.24.0. This issue does not occur in v0.23, and I've traced it down to 454567a as the cause.
Code to reproduce
which runs
Traceback
tests/operators/test_plots.py::test_spatial_pcolormesh_plot FAILED [100%]
================================================================================== FAILURES ==================================================================================
________________________________________________________________________ test_spatial_pcolormesh_plot ________________________________________________________________________
cube = <iris 'Cube' of air_temperature / (K) (time: 3; grid_latitude: 17; grid_longitude: 13)>
tmp_working_dir = PosixPath('/var/tmp/pytest-of-jfrost/pytest-889/test_spatial_pcolormesh_plot0')
def test_spatial_pcolormesh_plot(cube, tmp_working_dir):
"""Plot spatial pcolormesh plot of instant air temp."""
# Remove realization coord to increase coverage, and as its not needed.
cube.remove_coord("realization")
cube_2d = cube.slices_over("time").next()
> plot.spatial_pcolormesh_plot(cube_2d, filename="plot")
/net/home/h02/jfrost/Projects/CSET/tests/operators/test_plots.py:79:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/net/home/h02/jfrost/Projects/CSET/src/CSET/operators/plot.py:894: in spatial_pcolormesh_plot
_spatial_plot("pcolormesh", cube, filename, sequence_coordinate, stamp_coordinate)
/net/home/h02/jfrost/Projects/CSET/src/CSET/operators/plot.py:783: in _spatial_plot
plotting_func(
/net/home/h02/jfrost/Projects/CSET/src/CSET/operators/plot.py:277: in _plot_and_save_spatial_plot
fig.savefig(filename, bbox_inches="tight", dpi=_get_plot_resolution())
/tmp/persistent/conda/envs/cset-test/lib/python3.12/site-packages/matplotlib/figure.py:3395: in savefig
self.canvas.print_figure(fname, **kwargs)
/tmp/persistent/conda/envs/cset-test/lib/python3.12/site-packages/matplotlib/backend_bases.py:2175: in print_figure
self.figure.draw(renderer)
/tmp/persistent/conda/envs/cset-test/lib/python3.12/site-packages/matplotlib/artist.py:95: in draw_wrapper
result = draw(artist, renderer, *args, **kwargs)
/tmp/persistent/conda/envs/cset-test/lib/python3.12/site-packages/matplotlib/artist.py:72: in draw_wrapper
return draw(artist, renderer)
/tmp/persistent/conda/envs/cset-test/lib/python3.12/site-packages/matplotlib/figure.py:3162: in draw
mimage._draw_list_compositing_images(
/tmp/persistent/conda/envs/cset-test/lib/python3.12/site-packages/matplotlib/image.py:132: in _draw_list_compositing_images
a.draw(renderer)
/tmp/persistent/conda/envs/cset-test/lib/python3.12/site-packages/matplotlib/artist.py:72: in draw_wrapper
return draw(artist, renderer)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_GeoAxesPatched: title={'center': 'Untitled | 2022-09-21 03:00:00'}>, renderer = <matplotlib.backends.backend_agg.RendererAgg object at 0x2b336e9530e0>, kwargs = {}
@matplotlib.artist.allow_rasterization
def draw(self, renderer=None, **kwargs):
"""
Extend the standard behaviour of :func:`matplotlib.axes.Axes.draw`.
Draw image factory results before invoking standard Matplotlib drawing.
A global range is used if no limits have yet been set.
"""
# Shared processing steps
> self._draw_preprocess()
E TypeError: _GeoAxesPatched._draw_preprocess() missing 1 required positional argument: 'renderer'
/net/home/h02/jfrost/Projects/cartopy/lib/cartopy/mpl/geoaxes.py:494: TypeError
========================================================================== short test summary info ===========================================================================
FAILED tests/operators/test_plots.py::test_spatial_pcolormesh_plot - TypeError: _GeoAxesPatched._draw_preprocess() missing 1 required positional argument: 'renderer'
Full environment definition
Operating system
Linux (RHEL 7)
Cartopy version
0.24.0
Conda list
Metadata
Metadata
Assignees
Labels
No labels