Skip to content

fix: Handle react call going from box to violin plot#7811

Open
camdecoster wants to merge 4 commits into
masterfrom
cam/7791/box-to-violin-plot-fix
Open

fix: Handle react call going from box to violin plot#7811
camdecoster wants to merge 4 commits into
masterfrom
cam/7791/box-to-violin-plot-fix

Conversation

@camdecoster
Copy link
Copy Markdown
Contributor

@camdecoster camdecoster commented May 28, 2026

Description

Update box plot defaults to handle situation where Plotly.react is called to switch from box to violin plot.

Changes

  • Update default handling logic
  • Add test

Screenshots

Before After
image image

Testing

  • Be on master
  • Run the following snippet in Plotly devtools
    const box = {
        type: 'box',
        q1: [0.2],
        median: [0.5],
        q3: [0.8],
        lowerfence: [-2.5],
        upperfence: [2.7],
        name: 'X',
        boxpoints: false
    };
    const data = Array.from({ length: 500 }, () => (Math.random() - 0.5) * 4);
    const violin = {
        type: 'violin',
        y: data,
        box: { visible: true },
        meanline: { visible: true },
        name: 'X'
    };
    
    Plotly.newPlot(gd, [box]).then(() => Plotly.react(gd, [violin]));
  • Note the errors in the console and the incorrect violin plot
  • Switch to this branch
  • Run the same snippet
  • Note that there are no errors and and the correct violin plot
  • Also check CI

@camdecoster camdecoster marked this pull request as ready for review May 28, 2026 01:07
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

Successfully merging this pull request may close these issues.

1 participant