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

BoxWhisker with continuous x-axis breaks box_width. #6177

Open
BMM3 opened this issue Apr 8, 2024 · 1 comment
Open

BoxWhisker with continuous x-axis breaks box_width. #6177

BMM3 opened this issue Apr 8, 2024 · 1 comment

Comments

@BMM3
Copy link

BMM3 commented Apr 8, 2024

ALL software version info

holoviews : 1.18.3
bokeh : 3.4.0
pandas : 2.2.1

Description

I would like to overlay a boxwhisker plot with a scatterplot. When I create the scatter and boxwhisker plot separately, it's working fine. However, when I create an overlay, the width of the box (of the boxwhisker) is changing. It's getting very big.
Notice: it seems that the width of the box is dependent on the x-value of the x-axis.
Notice: I'm using bokeh as a backend.

I think when a scatter is added, the x-axis gets numerical values (not just categorical values) and the box width is adjusted to these numerical values which seems to be too big.
In the past this was working fine so I think it's a change in some recent holoviews or bokeh update.

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

import pandas as pd
import holoviews as hv
df = pd.DataFrame({'x':  [1,1,1,1], 
                   'y': [2,3,4,5],
                   })

p1 = hv.Scatter(df, 'x', 'y')
p2 = hv.BoxWhisker(df, 'x', 'y')

p1*p2

# p2 returns a normal boxplot while p1*p2 has a boxplot where the box width is changed.

Screenshots or screencasts of the bug in action

p2:
image

p1*p2:
image

@BMM3
Copy link
Author

BMM3 commented Apr 17, 2024

When you first create a boxplot and overlay a scatter over it, the width of the boxplot is normal. So in previous example "p2*p1" does give a good result.
Again, it seems to be related to the x-axis being continuous vs being categorical.

The width of the boxplot also seems to depend on the x value. In the previous example: when x = 1, the total box_width is 10. When x = 5, the total width is about 40.

The box_width option for boxwhisker also doesn't seem to change the box_width anymore.

@BMM3 BMM3 changed the title Overlay of BoxWhisker and Scatter increases box_width. BoxWhisker with continuous x-axis breaks box_width. Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant