home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

1 row where author_association = "NONE", issue = 307903558 and user = 6334793 sorted by updated_at descending

✎ View and edit SQL

This data as json, CSV (advanced)

Suggested facets: created_at (date), updated_at (date)

user 1

  • hrishikeshac · 1 ✖

issue 1

  • Removing inter-subplot spaces when using cartopy projections · 1 ✖

author_association 1

  • NONE · 1 ✖
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions performed_via_github_app issue
375726695 https://github.com/pydata/xarray/issues/2009#issuecomment-375726695 https://api.github.com/repos/pydata/xarray/issues/2009 MDEyOklzc3VlQ29tbWVudDM3NTcyNjY5NQ== hrishikeshac 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.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,wspace=0, hspace=0)

def set_map_layout(axes, width=17.0): """ set figure height, given width

Needs to be called after all plotting is done.
Source: @mathause https://github.com/mathause/mplotutils/blob/v0.1.0/mplotutils/mpl_utils.py#L47-L100
Parameters
----------
axes : ndarray of (Geo)Axes
    Array with all axes of the figure.
width : float
    Width of the full figure in cm. Default 17

..note: currently only works if all the axes have the same aspect
ratio.
"""

if isinstance(axes, plt.Axes):
    ax = axes
else:
    # assumes the first of the axes is representative for all
    ax = axes.flat[0]

# read figure data
f = ax.get_figure()

bottom = f.subplotpars.bottom
top = f.subplotpars.top
left = f.subplotpars.left
right = f.subplotpars.right
hspace = f.subplotpars.hspace
wspace = f.subplotpars.wspace

# data ratio is the aspect
aspect = ax.get_data_ratio()
# get geometry tells how many subplots there are
nrow, ncol, __ = ax.get_geometry()

# width of one plot, taking into account
# left * wf, (1-right) * wf, ncol * wp, (1-ncol) * wp * wspace
wp = (width - width * (left + (1-right))) / (ncol + (ncol-1) * wspace)

# height of one plot
hp = wp * aspect

# height of figure
height = (hp * (nrow + ((nrow - 1) * hspace))) / (1. - (bottom + (1 - top)))

f.set_figwidth(width / 2.54)
f.set_figheight(height / 2.54)

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)

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')
ax.set_xticks([])
ax.set_yticks([])
set_map_layout(ax)# plt.tight_layout()

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
}
  Removing inter-subplot spaces when using cartopy projections 307903558

Advanced export

JSON shape: default, array, newline-delimited, object

CSV options:

CREATE TABLE [issue_comments] (
   [html_url] TEXT,
   [issue_url] TEXT,
   [id] INTEGER PRIMARY KEY,
   [node_id] TEXT,
   [user] INTEGER REFERENCES [users]([id]),
   [created_at] TEXT,
   [updated_at] TEXT,
   [author_association] TEXT,
   [body] TEXT,
   [reactions] TEXT,
   [performed_via_github_app] TEXT,
   [issue] INTEGER REFERENCES [issues]([id])
);
CREATE INDEX [idx_issue_comments_issue]
    ON [issue_comments] ([issue]);
CREATE INDEX [idx_issue_comments_user]
    ON [issue_comments] ([user]);
Powered by Datasette · Queries took 484.324ms · About: xarray-datasette