home / github / issues

Menu
  • Search all tables
  • GraphQL API

issues: 522457033

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
522457033 MDU6SXNzdWU1MjI0NTcwMzM= 3524 xr.plot infers sequential colormap on diverging levels 10194086 closed 0     2 2019-11-13T20:32:46Z 2020-04-05T13:41:25Z 2020-04-05T13:41:25Z MEMBER      

MCVE Code Sample

```python import numpy as np import xarray as xr

data = np.random.randn(10, 10) data = np.abs(data)

da = xr.DataArray(data)

returns a diverging colormap

da.plot(vmax=2, center=0, extend="both")

returns a sequential colormap

da.plot(levels=[-2, -1, 0, 1, 2], extend="both")

```

Expected Output

A diverging colormap, maybe?

Problem Description

I was surprised by getting the viridis colormap until I realised that my data must all be positive and the colormap is infered from the data and not from levels. However, when specifying the range via vmax=2, center=0 it is not inferred from the data.

Output of xr.show_versions()

INSTALLED VERSIONS ------------------ commit: None python: 3.7.3 | packaged by conda-forge | (default, Jul 1 2019, 21:52:21) [GCC 7.3.0] python-bits: 64 OS: Linux OS-release: 4.12.14-lp151.28.25-default machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: en_GB.UTF-8 LOCALE: en_US.UTF-8 libhdf5: 1.10.4 libnetcdf: 4.6.2 xarray: 0.14.0+44.g4dce93f1 pandas: 0.25.2 numpy: 1.17.3 scipy: 1.3.1 netCDF4: 1.5.0.1 pydap: None h5netcdf: 0.7.4 h5py: 2.9.0 Nio: None zarr: None cftime: 1.0.4.2 nc_time_axis: 1.2.0 PseudoNetCDF: None rasterio: 1.0.22 cfgrib: None iris: None bottleneck: 1.2.1 dask: 2.6.0 distributed: 2.6.0 matplotlib: 3.1.1 cartopy: 0.17.0 seaborn: 0.9.0 numbagg: None setuptools: 41.4.0 pip: 19.3.1 conda: None pytest: 5.2.2 IPython: 7.9.0 sphinx: 2.2.1
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/3524/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

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