Skip to content

Fix #5613: contours.size ignored on initialization - #5760

Open
maram-odoo wants to merge 1 commit into
plotly:mainfrom
maram-odoo:fix-5613-contours-size
Open

maram-odoo wants to merge 1 commit into
plotly:mainfrom
maram-odoo:fix-5613-contours-size

Conversation

@maram-odoo

Copy link
Copy Markdown

Summary

  • Fixes [BUG]: contours.size initialization does not apply the specified value, but updates via dropdown work correctly #5613: when passing contours=dict(size=0.25) to go.Contour(), the size was stored correctly in Python (c.contours.size == 0.25) but lost during the initial render because plotly.js defaults autocontour to True, which auto-generates contour levels from ncontours and ignores contours.size.
  • The fix sets autocontour=False automatically when the user provides contours.size (or other explicit contour level attributes like start/end) without explicitly setting autocontour, ensuring the size is preserved in the serialized JSON and honored on first render.
  • The fix does NOT change behavior when autocontour is explicitly set by the user, or when no explicit contour attributes are provided (default autocontour=None → JS default of True is preserved for backward compatibility).

Test plan

  • go.Contour(z=[[1,2],[3,4]], contours=dict(size=0.25)) now serializes autocontour: false and contours.size: 0.25 in the JSON
  • go.Contour(z=[[1,2],[3,4]], contours=dict(size=0.25), autocontour=False) still works
  • go.Contour(z=[[1,2],[3,4]]) (no contours) preserves default behavior
  • go.Contour(z=[[1,2],[3,4]], autocontour=True, ncontours=5) still works
  • Figure-level path: go.Figure(data=[go.Contour(...)]) serializes correctly

🤖 Generated with Claude Code

When passing contours=dict(size=0.25) to go.Contour(), the size was
stored in Python but lost during the initial render because the default
autocontour=True in plotly.js auto-generates contour levels from ncontours
and ignores contours.size. Setting autocontour=False when the user provides
contours.size (without explicitly setting autocontour) ensures the size
is preserved in the serialized JSON and honored on first render.

Co-authored-by: openhands <openhands@all-hands.dev>
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.

[BUG]: contours.size initialization does not apply the specified value, but updates via dropdown work correctly

2 participants