home / github / issue_comments

Menu
  • GraphQL API
  • Search all tables

issue_comments: 642086321

This data as json

html_url issue_url id node_id user created_at updated_at author_association body reactions performed_via_github_app issue
https://github.com/pydata/xarray/issues/4137#issuecomment-642086321 https://api.github.com/repos/pydata/xarray/issues/4137 642086321 MDEyOklzc3VlQ29tbWVudDY0MjA4NjMyMQ== 3332539 2020-06-10T15:30:44Z 2020-06-11T09:51:48Z NONE

With pure matplotlib (avoiding the xarray.plot function) both versions show the data. However, calling set_boundary at the end would leave the data unrestricted.

```python import xarray as xr import matplotlib.pyplot as plt import matplotlib.path as mpath import cartopy.crs as ccrs import cartopy.feature as cfeature import numpy as np

ds = xr.tutorial.load_dataset('air_temperature')

ax = plt.subplot(projection=ccrs.NorthPolarStereo())

ax.set_boundary(circle, transform=ax.transAxes) # works and "cuts" also the data as in the example above

data = ds.air.isel(time=0)

ax.pcolor(data.lon, data.lat, data, transform=ccrs.PlateCarree())

theta = np.linspace(0, 2*np.pi, 100) center, radius = [0.5, 0.5], 0.5 verts = np.vstack([np.sin(theta), np.cos(theta)]).T circle = mpath.Path(verts * radius + center)

ax.coastlines() ax.gridlines() ax.set_extent([-180,180, 50,90], crs=ccrs.PlateCarree()) ax.set_boundary(circle, transform=ax.transAxes) # works for the axis border but not for the data ```

PS.: can I somehow append images of the plots?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  636200235
Powered by Datasette · Queries took 0.604ms · About: xarray-datasette