Fix #5613: Apply impliedEdits for contours initialization#5631
Open
yqtian-se wants to merge 1 commit into
Open
Fix #5613: Apply impliedEdits for contours initialization#5631yqtian-se wants to merge 1 commit into
yqtian-se wants to merge 1 commit into
Conversation
When creating Contour, Histogram2dContour, or Contourcarpet traces with contours.size, contours.start, or contours.end properties, the autocontour property should be automatically set to False to respect the manual contour specifications. The Plotly schema defines impliedEdits that set autocontour=False when these properties are specified. Previously, this only worked for dynamic updates via restyle (e.g., dropdown menus), but not for initial trace creation. Changes: - Modified codegen/datatypes.py to add get_implied_edits_code() function that generates Python code to apply impliedEdits during initialization - Updated build_datatype_py() to call get_implied_edits_code() and insert the generated code into __init__ methods The auto-generated graph_objs files should be regenerated by running: python codegen/__init__.py Fixes: plotly#5613 Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Link to issue
Closes #5613
Description of change
This PR fixes the issue where
contours.size,contours.start, andcontours.endproperties were ignored during initial Contour/Histogram2dContour/Contourcarpet trace creation. The fix modifies the code generator to automatically apply the schema's impliedEdits logic, which setsautocontour=Falsewhen these properties are specified, ensuring they are respected during rendering.Demo
Testing strategy
Added comprehensive test suite covering:
All tests pass successfully.
Additional information (optional)
Root Cause:
The Plotly schema defines impliedEdits that automatically set autocontour=False when contours.size/start/end are specified. This worked for dynamic updates (via dropdown restyle) but not for initial trace creation, because the Python code wasn't applying these implied edits.
Solution:
Modified the code generator (codegen/datatypes.py) to:
The auto-generated graph_objs files will be regenerated by running python codegen/init.py as part of the merge/CI process.
Why This Approach:
Files Modified
Guidelines