Skip to content

[BUG]: Swapping Figure from Summary Statistic Signature go.Box plot to go/px.Violin Plot causes Improper Display #7791

@kevin-gett

Description

@kevin-gett

Description

This bug is specific to go.Box or Box Figures in the Summary Statistic Signature being turned into any Violin Plot in the same plot area such as updating a figure in Dash's dcc.Graph. Swapping from a box with summary stats to a violin plot results in a large amount of errors/warnings in the webpage as well as failing to display the Violin plot correctly. This is due to the function calc(gd, trace) found in https://github.com/plotly/plotly.js/blob/master/src/traces/box/calc.js which is used by the violin plot when building. Specifically, in the line 66 block where ._hasPreCompStats is set to True for the box->violin plot. Traversing the trace in line 72 ends up traversing the violin plot trace instead of the box plot causing x warnings where x is the length of the violin's data size due to lines 82, 83, and 84 resolving d2c as undefined.

The setting of summary signatures ensures entry to ._hasPreCompStats which is why it is specific to the go.Box but extends to Plotly.js since this could be set simply with the figure dict.

Screenshots/Video

INITIAL VIEW OF SUMMARY STATISTIC SIG.:
Image
SWAPPED TO VIOLIN:
Image
EXPECTED OUTPUT (same go.violin but built after non-summary stats method box then violin):
Image

Steps to reproduce

I am most comfortable with Dash and Plotly.py so please find below the code for a sample Dash App that will display the Plotly.js issue.

test.py

  • Click on go.Box button (manual quartiles)
  • Click on either go.Violin or px.Violin (CAUSES LAG + WARNINGS)
  • Swap back to px.Box (calculated quartiles)
  • Click on either go.Violin or px.Violin (displays properly)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugsomething broken

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions