Skip to content

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

Merged
camdecoster merged 4 commits into
masterfrom
cam/7791/box-to-violin-plot-fix
May 29, 2026
Merged

fix: Handle react call going from box to violin plot#7811
camdecoster merged 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
Copy link
Copy Markdown
Contributor

@emilykl emilykl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 🚀

@camdecoster camdecoster merged commit 21ce92b into master May 29, 2026
83 checks passed
@camdecoster camdecoster deleted the cam/7791/box-to-violin-plot-fix branch May 29, 2026 20:05
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.

2 participants