home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 629387430

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/4061#issuecomment-629387430 https://api.github.com/repos/pydata/xarray/issues/4061 629387430 MDEyOklzc3VlQ29tbWVudDYyOTM4NzQzMA== 10194086 2020-05-15T17:33:33Z 2020-05-15T17:33:33Z MEMBER

If you use python norm = colors.BoundaryNorm(boundaries=bounds, ncolors=9) it works. A new norm with ncolors=9 is built in _build_discrete_cmap - however, it is not used as norm is already defined:

https://github.com/pydata/xarray/blob/2542a63f6ebed1a464af7fc74b9f3bf302925803/xarray/plot/utils.py#L290-L292

The fix might be to use:

python if levels is not None or isinstance(norm, mpl.colors.BoundaryNorm): cmap, norm = _build_discrete_cmap(cmap, levels, extend, filled) this breaks one test which is probably fixable (it tests that the norm is not changed when it is given).

Note that mpl seems to use a LinearSegmentedColormap while xarray creates a ListedColormap.

{
    "total_count": 1,
    "+1": 1,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  618141254
Powered by Datasette · Queries took 80.71ms · About: xarray-datasette