holoviz / holoviz/hvplot

Stacking plots with a datetime Index and plotly not showing data

Open
#1,295 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

I'm using hvplot with the plotly backend in VSCode. I'm finding that no data is being plotted when combining plots in a single layout when an axis has a datetime column.

## Versions
```
python: 3.8.11
hvplot: 0.9.2
plotly: 5.19.0
pandas: 2.2.1
VSCode: 1.87.2
OS: MacOS 14.3.1
Arch: arm64
```

## Code to reproduce
```
import pandas as pd
import hvplot as hp
import hvplot.pandas
hp.extension("plotly", logo=False)

# Sample data with dates from the last 7 days
date_range = pd.date_range(end=pd.Timestamp.today(), periods=7)
data = {'var1': [1, 2, 3, 4, 5, 6, 7], "var2": [8, 9, 10, 11, 12, 13, 14]}
df = pd.DataFrame(data, index=date_range)

df.index.name='time'

plot1 = df.hvplot(x='time', y='var1', label='var1', kind='line')
plot2 = df.hvplot(x='time', y='var2', label='var2', kind='line')

(plot1 + plot2).cols(1)
```

The resulting plot has no data, and several of these `BokehUserWarning`s pop up:
```
BokehUserWarning: out of range integer may result in loss of precision
```

image

Note the dates are centered around 2000 even though `df.index` are 2024 dates.

## Expected Behavior
What I expect to see is a stacked plot, like this:
image

- [x] 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.