home / github / issues

Menu
  • GraphQL API
  • Search all tables

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.shape

dx, dy = nx/ny, 1

figsize = 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 description

In 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 xr.show_versions()

INSTALLED VERSIONS ------------------ commit: None python: 3.6.4.final.0 python-bits: 64 OS: Darwin OS-release: 16.7.0 machine: x86_64 processor: i386 byteorder: little LC_ALL: None LANG: None LOCALE: None.None xarray: 0.10.0 pandas: 0.22.0 numpy: 1.14.0 scipy: 1.0.0 netCDF4: 1.3.1 h5netcdf: 0.5.0 Nio: None bottleneck: 1.2.1 cyordereddict: None dask: 0.16.1 matplotlib: 2.1.2 cartopy: 0.15.1 seaborn: 0.8.1 setuptools: 38.4.0 pip: 9.0.3 conda: 4.4.10 pytest: 3.3.2 IPython: 6.2.1 sphinx: 1.6.6
{
    "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

Links from other tables

  • 0 rows from issues_id in issues_labels
  • 2 rows from issue in issue_comments
Powered by Datasette · Queries took 0.578ms · About: xarray-datasette