holoviz / holoviz/hvplot

When using two pandas.DataFrame.interactive() to create a single plot, one one of the is visible (and duplicated)

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

Description

Writing this bug report as requested on [this Discourse thread](https://discourse.holoviz.org/t/how-to-plot-two-interactive-curves-on-top-of-each-other-using-two-pd-series/6727).

#### ALL software version info
I have the following versions, on python 3.10 on Ubuntu 22.04:

holoviews 1.18.1
hvplot 0.9.1
panel 1.3.6
bokeh 3.3.3
param 2.0.1

#### Description of expected behavior and the observed behavior

When using two pandas.DataFrame.interactive() to create a single plot, one one of the is visible. Expected both to be visible.

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

```python
import pandas as pd
import hvplot.pandas
import panel as pn

pn.extension(sizing_mode="stretch_width")

def get_data():
url = "https://data.seattle.gov/api/views/65db-xm6k/rows.csv?accessType=DOWNLOAD"
file = "rows.csv"
try:
seattle_bikes = pd.read_csv(file, parse_dates=["Date"]).set_index("Date")
except Exception:
seattle_bikes = pd.read_csv(url, parse_dates=["Date"]).set_index("Date")
seattle_bikes.to_csv(file)

bikes = seattle_bikes["Fremont Bridge Sidewalks, south of N 34th St"]
bikes.name = "data"
return bikes.to_frame()

rolling = pn.widgets.IntSlider(value=50, start=10, end=100)

seattle_bikes = get_data()

plot1 = (
seattle_bikes.interactive()
.resample("D")
.sum()
.rolling(rolling, center=True, win_type="gaussian")
.sum(std=10)
.hvplot(
line_dash=["solid", "dashed", "dotdash"],
responsive=True,
height=400,
title="Seattle Data",
)
)

seattle_bikes2 = seattle_bikes.copy()
seattle_bikes2["data"] += 1e4

plot2 = (
seattle_bikes2.interactive()
.resample("D")
.sum()
.rolling(rolling, center=True, win_type="gaussian")
.sum(std=10)
.hvplot(
line_dash=["solid", "dashed", "dotdash"],
responsive=True,
height=400,
title="Seattle Data",
)
)
pipeline = plot1 * plot2

pn.template.FastListTemplate(
sidebar=[pipeline.widgets()],
main=[pn.panel(pipeline.holoviews(), sizing_mode="stretch_width")],
).servable()
```

#### Screenshots or screencasts of the bug in action

Here is a screenshot of what you get (one curve duplicated, another not shown):
![image](https://github.com/holoviz/hvplot/assets/17479683/6878fb75-1c57-4336-884a-be0cbfaf00b4)

This is what you would expect to have (two curves with different data)
![image](https://github.com/holoviz/hvplot/assets/17479683/e132edf2-d226-4216-b3be-531b54c8c23e)

- [ ] I may be interested in making a pull request to address this

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.