home / github / issues

Menu
  • GraphQL API
  • Search all tables

issues: 353623661

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
353623661 MDU6SXNzdWUzNTM2MjM2NjE= 2381 Plotting norm is superseded by xarray vmin and vmax 1186928 closed 0     6 2018-08-24T02:47:17Z 2018-10-08T05:23:35Z 2018-10-08T05:23:35Z CONTRIBUTOR      

Code Sample

```python import numpy as np import xarray as xr import matplotlib.pyplot as plt import matplotlib.colors as mcolors

prepare array with values between 1e0 and 1e3

da = xr.DataArray(np.logspace(0, 3, 24).reshape(4, 6), dims=('x', 'y'))

but we want to log-normalize between 1e0 and 1e2

norm = mcolors.LogNorm(1e1, 1e2)

plot with log norm

da.plot.imshow(norm=norm) # log norm is applied but bounds are replaced

da.plot.imshow(norm=norm, vmin=norm.vmin, vmax=norm.vmax) # works, but redundant

show results

plt.show()

```

Problem description

When passing a norm argument to imshow etc, the norm is forwarded to matplotlib but its data bounds are replaced with those calculated by xarray.

Expected Output

I think that the norm's vmin and vmax should take precedence over xarray-generated vmin and vmax.

Output of xr.show_versions()

INSTALLED VERSIONS ------------------ commit: None python: 2.7.15.final.0 python-bits: 64 OS: Linux OS-release: 4.14.65-1-MANJARO machine: x86_64 processor: byteorder: little LC_ALL: None LANG: fr_CH.utf8 LOCALE: None.None xarray: 0.10.8 pandas: 0.23.4 numpy: 1.15.0 scipy: 1.1.0 netCDF4: 1.4.1 h5netcdf: None h5py: None Nio: None zarr: None bottleneck: None cyordereddict: None dask: 0.18.2 distributed: None matplotlib: 2.2.3 cartopy: 0.15.1 seaborn: None setuptools: 40.0.0 pip: 18.0 conda: None pytest: None IPython: 5.8.0 sphinx: 1.7.6
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/2381/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
  • 6 rows from issue in issue_comments
Powered by Datasette · Queries took 0.745ms · About: xarray-datasette