holoviz / holoviews

With Holoviews, your data visualizes itself.
https://holoviews.org
BSD 3-Clause "New" or "Revised" License
2.69k stars 402 forks source link

Stacked bars not rendered correctly with datetime axis #6288

Closed TheoMathurin closed 1 week ago

TheoMathurin commented 3 months ago

With HoloViews 1.19.0, #6145 brought an interesting feature with continuous axis support for hv.Bars.

However, now when the stacked option is enabled, bars are not rendered correctly on a datetime x-axis. As an aside, xlims seem to be ignored.


import datetime as dt
import holoviews as hv
import pandas as pd

data = pd.DataFrame({"x": pd.to_datetime(["2017-01-01T00:00:00",
                                          "2017-01-01T00:00:00",
                                          "2017-01-01T01:00:00",
                                          "2017-01-01T01:00:00",
                                          "2017-01-01T02:00:00",
                                          "2017-01-01T02:00:00"]),
                     "cat": ["A", "B", "A", "B", "A", "B"],
                     "y": [0, 2, 1, 5, 1, 2]})
hv.Bars(data, ["x", "cat"], ["y"]).opts(
    width=600, stacked=True, xlim=(dt.datetime(2017, 1, 1), dt.datetime(2017, 1, 2)))

issue_bars

The horizontal elements displayed extend across the x-axis just as HLine or HSpan.

I have no error in python or in the browser.

TheoMathurin commented 2 months ago

Any idea where to look for in order to fix this? I'm willing to spend some time as this bug prevents me from updating to 1.19.

MarcSkovMadsen commented 2 months ago

On holiday ⛱️ find the PR adding support for continous axis. Find the file(s) that changed. Try to debug basic example and figure out how it works.

philippjfr commented 2 months ago

I'll take a quick look at it, I suspect we didn't consider the grouped/stacked conditions at all.