-
-
Notifications
You must be signed in to change notification settings - Fork 402
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
Grouped Bars not rendering correctly #5726
Comments
This is a Bokeh problem with # This is mostly code from webpage.
import holoviews as hv
import numpy as np
import pandas as pd
hv.extension("bokeh")
samples = 100
pets = ["Dog"]
genders = ["Female", "Male"]
pets_sample = np.random.choice(pets, samples)
gender_sample = np.random.choice(genders, samples)
count = np.random.randint(1, 5, size=samples)
df = pd.DataFrame({"Pets": pets_sample, "Gender": gender_sample, "Count": count})
bars = hv.Bars(df, kdims=["Pets", "Gender"]).aggregate(function=np.sum) Converting the code to Bokeh, from bokeh.io import show
from bokeh.models import Row
bp_org = hv.render(bars)
bp_fix = hv.render(bars)
data = bp_fix.renderers[0].data_source.data
data["xoffsets"] = data["xoffsets"].tolist()
show(Row(bp_org, bp_fix)) |
Is the same thing happening for box plots or is that a different issue? https://holoviews.org/gallery/demos/bokeh/boxplot_chart.html today looks like this, whereas I would expect the boxes to be non-overlapping: |
This is the same issue. If you need to use this functionality right now, you can use the following hook: def dtype_fix_hook(plot, element):
renderers = plot.handles["plot"].renderers
for renderer in renderers:
data = renderer.data_source.data
for k, v in data.items():
if hasattr(v, "dtype") and v.dtype.kind == "U":
data[k] = v.tolist()
boxwhisker.opts(hooks=[dtype_fix_hook]) |
I will close the issue as we have a workaround in Holoviews. https://holoviews.org/reference/elements/bokeh/Bars.html https://holoviews.org/gallery/demos/bokeh/boxplot_chart.html |
Noticed this in hvplot documentation and also on the latest dev build:
http://dev.holoviews.org/reference/elements/bokeh/Bars.html
The text was updated successfully, but these errors were encountered: