-
-
Notifications
You must be signed in to change notification settings - Fork 404
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Area/Bar stacking implementation #5235
Comments
Would adding |
Yes, it indeed solves the issue! I didn't know there is such option. df = pd.DataFrame({'a': [2, 3, 1], 'b': [1, 2, 3], 'c': [3, 2, 1]})
df.hvplot.area(y=['b', 'c', 'a'], stacked=True) Though on a higher level maybe it worth considering unifying stacking for both these charts? Ideally it seems reasonable to extract this functionality in a common helper method and make use of bokeh methods, or at least to have it on the same level, whereas currently bar chart is stacked on plotting/bokeh level, while area chart is stacked on a more abstract level before specific backend, which might cause inconsistencies when using other backends. |
Happy to consider a PR either just making this tiny |
This is a quick fix of holoviz#5235, until a more thorough refactoring (if ever) as discussed there.
I'll proceed with the quick fix option for now, as indeed, refactoring requires much deeper understanding of the library. |
This is a quick fix of #5235, until a more thorough refactoring (if ever) as discussed there.
This is a quick fix of #5235, until a more thorough refactoring (if ever) as discussed there.
This is related to holoviz/hvplot#551, but I think it is a more broad issue. For bar charts specifying columns order works as expected (except reversed legend), but for area chart this order is not respected.
I believe this is due rather different implementations. For area it goes inside
Area.stack
and hasdf.groupby(level=levels)
which causes sorting implicitly:holoviews/holoviews/element/chart.py
Lines 237 to 264 in b6ff2d1
Whereas for bar charts it is handled on plotting level in
BarPlot.get_stack
:holoviews/holoviews/plotting/bokeh/chart.py
Lines 828 to 848 in b6ff2d1
Also I'm not sure why not to just use ad hoc bokeh methods vbar_stack and varea_stack for this.
The text was updated successfully, but these errors were encountered: