hvplot
hvplot copied to clipboard
Strange behaviour of generated HTML file
ALL software version info
(this library, plus any other relevant software, e.g. bokeh, python, notebook, OS, browser, etc should be added within the dropdown below.)
Software Version Info
pandas-2.2.3
holoviews-1.20.2
hvplot-0.11.3
Python 3.11.11
Windows 11 x64, Version 24H2 (OS Build 26100.4061)
Firefox 138.0.4
Edge 136.0.3240.92 (Official build) (64-bit)
Description of expected behavior and the observed behavior
Expected: generated HTML file should display all graphs with all data consistently Observed: some data is missing from selected graphs when a previous graph had different groups. Steps to reproduce (after running the code):
- Open the generated HTML file (dummy.html) in a browser -> "group1" is displayed with two lines (blue and red)
- Select "group3" from the "key1"-menu -> "group3" is missing some line already (should be displayed in yellow
- Select "group1" from the "key1"-menu -> "group1" is now missing part of the data, too (red part is missing), also the legend is not updated
- Select "group2" from the "key1"-menu -> data is displayed correctly, also legend is updated
- Select "group1" from the "key1"-menu -> data is displayed correctly again
Complete, minimal, self-contained example code that reproduces the issue
from __future__ import annotations
import pandas as pd
import holoviews as hv
import hvplot
from hvplot import pandas # noqa: F401
data = [
{"key1": "group1", "key2": 0, "x": 1, "y": 1},
{"key1": "group1", "key2": 0, "x": 2, "y": 2},
{"key1": "group1", "key2": 1, "x": 3, "y": 3},
{"key1": "group1", "key2": 1, "x": 4, "y": 4},
{"key1": "group2", "key2": 0, "x": 1, "y": 1},
{"key1": "group2", "key2": 0, "x": 2, "y": 2},
{"key1": "group2", "key2": 1, "x": 4, "y": 4},
{"key1": "group2", "key2": 1, "x": 5, "y": 5},
{"key1": "group3", "key2": 0, "x": 1, "y": 1},
{"key1": "group3", "key2": 0, "x": 2, "y": 2},
{"key1": "group3", "key2": 2, "x": 5, "y": 5},
{"key1": "group3", "key2": 2, "x": 6, "y": 6},
]
df = pd.DataFrame(data)
graph = df.hvplot.line(x="x", y="y", by="key2", groupby="key1")
hv.save(graph, "dummy.html")
Stack traceback and/or browser JavaScript console output
Screenshots or screencasts of the bug in action
- [ ] I may be interested in making a pull request to address this