Skip to content
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

Multilevel boxplot categorical axis alignment disrupted by overlay with HLine #5941

Closed
liusynevolab opened this issue Oct 15, 2023 · 0 comments · Fixed by #5942
Closed

Multilevel boxplot categorical axis alignment disrupted by overlay with HLine #5941

liusynevolab opened this issue Oct 15, 2023 · 0 comments · Fixed by #5942
Labels
tag: backend: bokeh type: bug Something isn't correct or isn't working

Comments

@liusynevolab
Copy link

ALL software version info

(this library, plus any other relevant software, e.g. bokeh, python, notebook, OS, browser, etc)
holoviews version 1.17.1
bokeh version 3.2.2

Issue found from exported html plot, but reproducing the issue in a jupyter notebook

Description of expected behavior and the observed behavior

I wanted to use hv.HLines in combination with a boxplot, but I wanted to keep the lines behind the boxplots for aesthetic purposes. Unfortunately, when the two plots are ordered such that the HLine is behind the boxplots, the categorical axis alignment is disrupted, essentially breaking the boxplot. I have another boxplot without a multilevel categorical axis and that is not disrupted, so this should be more related to the categorical axis than the boxplot

Complete, minimal, self-contained example code that reproduces the issue

import holoviews as hv
import pandas as pd
import numpy as np
hv.extension('bokeh')

data = {
    'Category': ['A']*40 + ['B']*40,
    'Subcategory': (['X']*20 + ['Y']*20)*2,
    'Value': np.random.rand(80)
}

df = pd.DataFrame(data)

box_plot = hv.BoxWhisker(df, ['Category', 'Subcategory'], 'Value')
h_line = hv.HLine(y=0.5).opts(color='red', line_width=2)

# Demonstrating the issue
# This should work fine
display((box_plot * h_line).opts(width=600, height=400))

# This produces the alignment issue
display((h_line * box_plot).opts(width=600, height=400))

Screenshots or screencasts of the bug in action

plot 1:
image

plot 2:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tag: backend: bokeh type: bug Something isn't correct or isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants