home / github

Menu
  • GraphQL API
  • Search all tables

issue_comments

Table actions
  • GraphQL API for issue_comments

2 rows where author_association = "MEMBER", issue = 97861940 and user = 2443309 sorted by updated_at descending

✎ View and edit SQL

This data as json, CSV (advanced)

Suggested facets: updated_at (date)

user 1

  • jhamman · 2 ✖

issue 1

  • discrete colormap option for imshow and pcolormesh · 2 ✖

author_association 1

  • MEMBER · 2 ✖
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions performed_via_github_app issue
126445362 https://github.com/pydata/xarray/issues/500#issuecomment-126445362 https://api.github.com/repos/pydata/xarray/issues/500 MDEyOklzc3VlQ29tbWVudDEyNjQ0NTM2Mg== jhamman 2443309 2015-07-30T19:24:33Z 2015-07-30T19:24:33Z MEMBER

I have this mostly working on my branch now. A few questions before I issue a PR.

@clarkfitzg - do you happen to have any example code that creates intervals from a list? I also think it would be better to only use ticks defined by the user, so your case would need to be: myarray.plot_imshow(cmap_intervals=[-np.inf, -1, 1, np.inf]).

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  discrete colormap option for imshow and pcolormesh 97861940
125974756 https://github.com/pydata/xarray/issues/500#issuecomment-125974756 https://api.github.com/repos/pydata/xarray/issues/500 MDEyOklzc3VlQ29tbWVudDEyNTk3NDc1Ng== jhamman 2443309 2015-07-29T14:45:51Z 2015-07-29T14:45:51Z MEMBER

Exactly.

I've used something like this to generate the discrete colormap:

``` python def cmap_discretize(cmap, n_colors): """Return a discrete colormap from the continuous colormap cmap.

Parameters
----------
cmap : str or colormap object
    Colormap to discretize.
n_colors : int
    Number of discrete colors to divide `cmap` into.

Returns
----------
discrete_cmap : LinearSegmentedColormap
    Discretized colormap.
"""
from matplotlib.colors import LinearSegmentedColormap
import matplotlib.pyplot as plt

if type(cmap) == basestring:
    cmap = plt.get_cmap(cmap)
colors_i = np.concatenate((np.linspace(0, 1., n_colors), (0., 0., 0., 0.)))
colors_rgba = cmap(colors_i)
indices = np.linspace(0, 1., n_colors + 1)
cdict = {}
for ki, key in enumerate(('red', 'green', 'blue')):
    cdict[key] = [(indices[i], colors_rgba[i - 1, ki], colors_rgba[i, ki])
                  for i in range(n_colors + 1)]
# Return colormap object.
return LinearSegmentedColormap(cmap.name + "_%d" % n_colors, cdict, 1024)

```

Typically, I've manually constructed the colorbar by hand with the discrete colormap:

``` python cmap = cmap_discretize(cmap, n_colors=10) cnorm = mpl.colors.Normalize(vmin=vmin, vmax=vmax) cticks = np.linspace(vmin, vmax, num=cn + 1)

cb = mpl.colorbar.ColorbarBase(cax, cmap=cmap, norm=cnorm, orientation='vertical', extend=cbar_extend, ticks=cticks) ```

I'm sure this later part can be improved. Possibly by using matplotlib.ticker.MaxNLocator to find/set the ticks and intervals.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  discrete colormap option for imshow and pcolormesh 97861940

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 2256.919ms · About: xarray-datasette