Skip to content

Violin plot hover labels lose formatting #3875

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

Closed
clegaspi opened this issue May 17, 2019 · 2 comments
Closed

Violin plot hover labels lose formatting #3875

clegaspi opened this issue May 17, 2019 · 2 comments
Assignees
Labels
bug something broken

Comments

@clegaspi
Copy link

clegaspi commented May 17, 2019

Hi there,

I don't have experience writing Javascript, so I can't offer a solution. However, I want to report some issues with the violin plot hover labels losing their formatting when certain criteria are met.

Expected result: Violin plot hover text has a background color and text color matching/determined by the color of the violin plot.

Actual result: Hover text has a transparent background and white text (hardly visible against white background)

Steps to reproduce

  1. Create new violin plot with the following settings:
trace = {
    "type": "violin",
    "x": ["x", "x", "x", "x", "x"],
    "y": [1, 2, 3.0000001, 4, 5],
    "meanline": {"visible": True},
    "hoverinfo": "y",
    "hoveron": "violins+points+kde"
}
layout = {"plot_bgcolor": "black"}
figure = go.Figure(data=[trace], layout=layout)

The plot background set to black is only to see the white text due to the lost formatting.

  1. Observe the following:
    Screen Shot 2019-05-16 at 1 45 09 PM
    The hover labels are incorrectly formatted. If points: 'all' is enabled, the point hover labels also have incorrect formatting.

  2. Change one of the following to restore correct behavior:

  • y: [1, 2, 3.0000001, 4, 5] to y: [1, 2, 3, 4, 5]
  • meanline: {"visible": True} to meanline: {"visible": False}
  • hoveron: "violins+points+kde" to any other option for hoveron, including just "kde"
    Screen Shot 2019-05-16 at 1 49 20 PM
    Example above is with mean line hidden.

Notes: This occurs using the Python API and in the online editor, so I think this is an underlying issue with the plotly.js. In addition, the formatting disappears depending on the axes limits of the plot, set by zooming or manually in code. If the zoom level is not set such that you can see the entire box and whisker plot (I think), then the hover labels lose their formatting. But when set to a large enough range to span the box, the labels are ok again. If you go to the plotly example page for the violin plot and zoom in on the plots, you can observe that the label formatting disappears.
Screen Shot 2019-05-17 at 10 14 39 AM
Default zoom
Screen Shot 2019-05-17 at 10 15 08 AM
Zoom in a little, but the whole box-and-whisker plot is visible.
Screen Shot 2019-05-17 at 10 15 26 AM
Top of box-and-whisker is cut off, hover labels lose formatting.

Update: It also appears that when the hover labels lose their formatting, click events don't get fired. I am using a violin plot in a dash app and the click callback does not fire when the labels are not displayed correctly.

@etpinard
Copy link
Contributor

In a codepen: https://codepen.io/etpinard/pen/wberrP?editors=1010

image

something looks off in hoverAvoirOverlaps in Fx.hover.


Thanks very much for the report @clegaspi !

@etpinard
Copy link
Contributor

Fixed in #3889

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken
Projects
None yet
Development

No branches or pull requests

2 participants