issue_comments: 125974756
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/500#issuecomment-125974756 | https://api.github.com/repos/pydata/xarray/issues/500 | 125974756 | MDEyOklzc3VlQ29tbWVudDEyNTk3NDc1Ng== | 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.
``` 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 |
{
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} |
97861940 |