holoviz / holoviz/hvplot

Display units in the legend title

Open
#956 0 comments 0 reactions 0 assignees View on GitHub
interface: xarray
Dominant language
Python
Stars
1.4k
Forks
124
Avg merge
1d 18h
Merged PRs (30d)
1

Description

xarray displays the `units` *attr* in bracket in the legend title while hvplot displays it on every legend entry.

```python
import hvplot.xarray
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import xarray as xr

airtemps = xr.tutorial.open_dataset("air_temperature")
air = airtemps.air - 273.15
air.attrs = airtemps.air.attrs
air.attrs["units"] = "deg C"
air.isel(lon=10, lat=[19, 21, 22]).plot.line(x="time")
```

![image](https://user-images.githubusercontent.com/35924738/198547228-bfa4384d-352c-43b9-b98d-ec129da3215e.png)

`air.isel(lon=10, lat=[19, 21, 22]).hvplot.line(by='lat')`:

![image](https://user-images.githubusercontent.com/35924738/198547480-814160ae-0e99-4453-a87a-042e3ecbcfa2.png)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.