holoviz / holoviz/hvplot

hvplot and holoviews unconsistencies

Open
#1,017 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1.4k
Forks
124
Avg merge
1d 18h
Merged PRs (30d)
1

Description

#### ALL software version info
python : 3.9.13 | packaged by conda-forge | (main, May 27 2022, 16:56:21) [GCC 10.3.0]
pandas : 1.5.1
holoviews : 1.15.1
hvplot : 0.8.1
bokeh : 2.4.3
matplotlib : 3.6.1

#### Description of expected behavior and the observed behavior
When I am composing plots build with hvplot (https://hvplot.holoviz.org/user_guide/Plotting.html#composing-plots), it behaves not consistently with some options. Legend has no legend title in composite plot, option like 'legend' doesn't produce any effect with 'matplotlib' extension. And more confusingly, I have to use the holoviews `legend_position` in composite plots options, not hvplot `legend` option. I haven't check more options but here are some API discrepancies between hvplot and holoviews modules and bokeh and matplotlib extensions.

I expect that extensions behaves in the same way when composing plots from hvplot. And I think make difference in options name between hvplot and holoviews is very confusing.

In the same way, the `alpha=` (and not `line_alpha=`) keywords seems strange with `compatibility='bokeh'`.

#### Complete, minimal, self-contained example code that reproduces the issue

```python
import numpy as np
import pandas as pd
import hvplot
import hvplot.pandas
hvplot.extension('bokeh')
index = pd.date_range('1/1/2000', periods=1000)
df = pd.DataFrame(np.random.randn(1000, 4), index=index, columns=list('ABCD')).cumsum()
p1 = df.hvplot(width=400, line_width=4, line_dash='dashed', legend='top')
p2 = df.hvplot(width=400, alpha=0.5, legend='top')
p1 + p2 + p1*p2
```
produces
![image](https://user-images.githubusercontent.com/8038190/215065130-57a52fce-8a78-467c-9bd5-123b17bb074a.png)
while
```python
hvplot.extension('matplotlib', compatibility='bokeh')
index = pd.date_range('1/1/2000', periods=1000)
df = pd.DataFrame(np.random.randn(1000, 4), index=index, columns=list('ABCD')).cumsum()
p1 = df.hvplot(width=400, line_width=4, line_dash='dashed', legend='top')
p2 = df.hvplot(width=400, alpha=0.5, legend='top')
p1 + p2 + p1*p2
```
![image](https://user-images.githubusercontent.com/8038190/215063925-555712df-48db-4891-a613-1f8a157ceebb.png)
for which you need to specify `legend_position` (and not `legend` as `hvplot` options) to get a similar behavior between `matplotlib` and `bokeh` extension.
```python
p1 + p2 + (p1*p2).opts(legend_position='top')
```
![image](https://user-images.githubusercontent.com/8038190/215065731-adb79908-fd3a-4ce6-a26a-eaeb6e1e094d.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.