issue_comments: 375726695
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/2009#issuecomment-375726695 | https://api.github.com/repos/pydata/xarray/issues/2009 | 375726695 | MDEyOklzc3VlQ29tbWVudDM3NTcyNjY5NQ== | 6334793 | 2018-03-23T16:40:06Z | 2018-03-23T16:43:45Z | NONE | @mathause Thanks! Your solution worked brilliantly when used with contourf(). Here's how the code looks after implementing it. ```python import cartopy.crs as ccrs import xarray as xr import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec projection = False ts = xr.tutorial.load_dataset('air_temperature').air[0, ...] ncols, nrows = 2, 2 fig = plt.figure() ny,nx = ts.shapedx, dy = nx/ny, 1figsize = plt.figaspect(float(dy * ncols) / float(dx * nrows))fig = plt.figure(figsize=figsize)gs = gridspec.GridSpec(ncols, nrows,wspace=0, hspace=0) def set_map_layout(axes, width=17.0): """ set figure height, given width
for i in range(4): if projection: ax = plt.subplot(gs[i], projection=ccrs.PlateCarree()) ax.coastlines() ts.plot.contourf(ax=ax, add_colorbar=False, add_labels=False, levels=11, transform=ccrs.PlateCarree()) else: ax = plt.subplot(gs[i]) ts.plot.contourf(ax=ax, add_colorbar=False, levels=11, add_labels=False)
fig.subplots_adjust()```
without projection:
With projection:
|
{ "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
307903558 |