oceanspy icon indicating copy to clipboard operation
oceanspy copied to clipboard

plot.horizontal_section break by matplotlib version >3.5.2

Open MaceKuailv opened this issue 2 years ago • 3 comments

All tests related to plot.horizontal_section is broke, likely because of matplotlib.

To reproduce the error try the following:

import oceanspy as ospy
import cartopy
import matplotlib as mpl
print('mpl version:',mpl.__version__)
print('cartopy version:',cartopy.__version__)
od = ospy.open_oceandataset.from_catalog('get_started')
od.plot.horizontal_section(varName = 'XC')

I got the error "AttributeError: 'GeoAxesSubplot' object has no attribute '_autoscaleXon' " with mpl 3.6.1 and cartopy 0.19.0.post1, but no error on Oceanography image with 3.5.1 and 0.19.0.post1.

See this cartopy issue for more info. https://github.com/SciTools/cartopy/issues/2086

The straightforward solution is to pin matplotlib until cartopy people solve this issue from their end.

MaceKuailv avatar Oct 24 '22 15:10 MaceKuailv

It works for me on SciServer:

image

ThomasHaine avatar Oct 24 '22 16:10 ThomasHaine

You have mpl version 3.5.2, an older version. That's why it is not broken.

MaceKuailv avatar Oct 24 '22 16:10 MaceKuailv

@MaceKuailv FYI I just checked the oceanspy_test environment that I used for testing in my local computer and matplotlib indeed is version 3.5.1 (also checked and xgcm is version 0.6 and xarray is 0.21.1).

All good signs that indeed the issue is a maplotlib rather than cartopy.

Mikejmnez avatar Oct 24 '22 18:10 Mikejmnez

Since cartopy is now unpinned, this issue will automatically be resolved once cartopy people fixed the bug.

MaceKuailv avatar Nov 14 '22 22:11 MaceKuailv

Closed with PR #348

MaceKuailv avatar May 05 '23 15:05 MaceKuailv