issues: 307903558
This data as json
id | node_id | number | title | user | state | locked | assignee | milestone | comments | created_at | updated_at | closed_at | author_association | active_lock_reason | draft | pull_request | body | reactions | performed_via_github_app | state_reason | repo | type |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
307903558 | MDU6SXNzdWUzMDc5MDM1NTg= | 2009 | Removing inter-subplot spaces when using cartopy projections | 6334793 | closed | 0 | 2 | 2018-03-23T05:02:59Z | 2018-03-23T16:45:15Z | 2018-03-23T16:45:15Z | NONE | Code Sample, a copy-pastable example if possible```python import cartopy.crs as ccrs import xarray as xr import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec projection = True 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) for i in range(4): if projection: ax = plt.subplot(gs[i], projection=ccrs.PlateCarree()) ax.coastlines() ts.plot(ax=ax, add_colorbar=False, add_labels=False, transform=ccrs.PlateCarree()) else: ax = plt.subplot(gs[i]) ts.plot(ax=ax, add_colorbar=False, add_labels=False) ax.set_xticks([]) ax.set_yticks([]) # ax.set_aspect('auto', adjustable='box-forced') if (i == 0) or (i == 1): ax.set_title('title') if (i == 0) or (i == 2): ax.set_ylabel('ylabel') plt.tight_layout()fig.subplots_adjust(wspace=0, hspace=0) plt.show() ``` Problem descriptionIn the above script, the subplots get plotted with no in-between spaces if no projection information is provided (i.e. projection=False).
But when projection info is provided, there is pretty much no way of removing the inter-column (or inter-row) spaces.
Commented lines are the different ways that I tried to remove the spaces. Output of
|
{ "url": "https://api.github.com/repos/pydata/xarray/issues/2009/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
completed | 13221727 | issue |