Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plot example broken in 0.6.1 #647

Closed
fmaussion opened this issue Nov 6, 2015 · 11 comments
Closed

Plot example broken in 0.6.1 #647

fmaussion opened this issue Nov 6, 2015 · 11 comments

Comments

@fmaussion
Copy link
Member

The plotting-with-cartopy example from the docs: http://xray.readthedocs.org/en/stable/plotting.html

is broken with the last conda install (xray 0.6.1, linux, python 3.4, mpl 1.4.3). It used to work fine in 0.6.0:

(test_xray)mowglie@flappi ~ $ python test_xray.py 
Traceback (most recent call last):
  File "test_xray.py", line 17, in <module>
    transform=ccrs.PlateCarree())
  File "/home/mowglie/.bin/conda/envs/test_xray/lib/python3.4/site-packages/xray/plot/plot.py", line 246, in __call__
    return plot(self._da, **kwargs)
  File "/home/mowglie/.bin/conda/envs/test_xray/lib/python3.4/site-packages/xray/plot/plot.py", line 124, in plot
    return plotfunc(darray, **kwargs)
  File "/home/mowglie/.bin/conda/envs/test_xray/lib/python3.4/site-packages/xray/plot/plot.py", line 417, in newplotfunc
    **kwargs)
  File "/home/mowglie/.bin/conda/envs/test_xray/lib/python3.4/site-packages/xray/plot/plot.py", line 547, in pcolormesh
    primitive = ax.pcolormesh(x, y, z, **kwargs)
  File "/home/mowglie/.bin/conda/envs/test_xray/lib/python3.4/site-packages/cartopy/mpl/geoaxes.py", line 1134, in pcolormesh
    result = self._pcolormesh_patched(*args, **kwargs)
  File "/home/mowglie/.bin/conda/envs/test_xray/lib/python3.4/site-packages/cartopy/mpl/geoaxes.py", line 1192, in _pcolormesh_patched
    antialiased=antialiased, shading=shading, **kwargs)
  File "/home/mowglie/.bin/conda/envs/test_xray/lib/python3.4/site-packages/matplotlib/collections.py", line 1683, in __init__
    Collection.__init__(self, **kwargs)
  File "/home/mowglie/.bin/conda/envs/test_xray/lib/python3.4/site-packages/matplotlib/collections.py", line 135, in __init__
    self.update(kwargs)
  File "/home/mowglie/.bin/conda/envs/test_xray/lib/python3.4/site-packages/matplotlib/artist.py", line 757, in update
    raise AttributeError('Unknown property %s' % k)
AttributeError: Unknown property origin
@clarkfitzg
Copy link
Member

@fmaussion Can you post the contents of test_xray.py? I tried running a Cartopy script with

last conda install (xray 0.6.1, linux, python 3.4, mpl 1.4.3)

and everything looks good locally.

@fmaussion
Copy link
Member Author

Yes sorry:

import xray
import numpy as np
import matplotlib.pyplot as plt
import cartopy.crs as ccrs

nlat = 15
nlon = 5
arr = np.random.randn(nlat, nlon)
arr[0, 0] = np.nan
atlantic = xray.DataArray(arr,
        coords = (np.linspace(50, 20, nlat), np.linspace(-60, -20, nlon)),
        dims = ('latitude', 'longitude'))

ax = plt.axes(projection=ccrs.Orthographic(-50, 30))

atlantic.plot(ax=ax, origin='upper', aspect='equal',
              transform=ccrs.PlateCarree())

ax.set_global()
ax.coastlines()

I just tested it on master and I have the same problem...

@clarkfitzg
Copy link
Member

Some changes have been made to the plot functions. This one works for me:

atlantic.plot(ax=ax, transform=ccrs.PlateCarree())

The latest version of the docs has a better plot that actually uses real data: http://xray.readthedocs.org/en/latest/plotting.html#maps

@fmaussion
Copy link
Member Author

Thanks. I've just tested it with my data which needed the two keywords origin='upper', aspect='equal'. Now it seems that they are set/inferred per default, which is good. So that's just the online documentation that needs a fix.

@shoyer
Copy link
Member

shoyer commented Nov 10, 2015

@fmaussion would you mind putting together a quick PR to fix the code in the docs? That way I don't screw up by mis-transcribing it :).

@jhamman
Copy link
Member

jhamman commented Nov 10, 2015

Be aware too that the latest build on readthedocs is broken so we won't see any updates right away.

@clarkfitzg
Copy link
Member

But the docs on master are good? @shoyer or did you mean something about old vs new behavior?

@jhamman
Copy link
Member

jhamman commented Nov 10, 2015

But the docs on master are good?

No, the last successful build from master was 0.6. We didn't update stable after the 0.6.1 release because the build was broken. See #601.

@shoyer
Copy link
Member

shoyer commented Nov 10, 2015

Oops, I was confused. The docs on master do seem to fixed! Unfortunately RTD has been broken for the last month or so which has complicated making a new release.

@fmaussion
Copy link
Member Author

I guess I can close this issue?

@clarkfitzg
Copy link
Member

Yes, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants