Preserve custom linestyles in Qt figure options#31318
Preserve custom linestyles in Qt figure options#31318Raynasty66 wants to merge 1 commit intomatplotlib:mainfrom
Conversation
Fixed an issue where custom tuple dash patterns changes to the unscaled dash pattern when accessing "Edit axis, curve and image parameters" button
|
Thank you for opening your first PR into Matplotlib! If you have not heard from us in a week or so, please leave a new comment below and that should bring it to our attention. Most of our reviewers are volunteers and sometimes things fall through the cracks. You can also join us on gitter for real-time discussion. For details on testing, writing docs, and our review process, please see the developer guide. We strive to be a welcoming and open project. Please follow our Code of Conduct. |
|
After checking what tests failed, I can conclude that all failures listed are not relevant to the files I edited, as this pull request only modifies figureoptions.py and tests_backend_qt.py, none of which were the cause of failure for these tests (test_backends_interactive::test_webagg and test_colorbar/test_basic follow on subprocess warnings.) |
|
The root cause is that get_linestyle() only returns a simplified string for dashed styles (#17316). Therefore, set_linestyle(get_linestyle()) may change the linestyle. Ideally, we would find a solution to that issue, but a local workaround for the dialog is also acceptable. |
Fixed an issue where custom tuple dash patterns change to the unscaled dash pattern when trying to navigate off of "Edit axis, curve and image parameters"
PR summary
PR request fixes bug #31289
Currently, when a line uses any custom dash style, if one opens the qt bar option "Edit axis, curve, and image parameters", it automatically would switch the line style to a default "style token", which in this bug case was a "--"
This happened because
Line2D.get_linestyle()reports a the default style token, which was tripped by the "edit axis... and image parameters" tripping set_linestyle(...) , replacing the custom tuple token. :(PR edits figureoptions.py to where if the custom pattern and the default pattern differ, it defaults to the custom pattern specified.
AI Disclosure
AI was used to generate the test case inside test_backend_qt, labeled "test_figureoptions_preserves_custom_dash_tuple" to test if the bug was still present. All code / behavior manually reviewed by me
PR checklist