Fix marker fillstyle rotation when updating fillstyle in Line2D#31265
Fix marker fillstyle rotation when updating fillstyle in Line2D#31265jayaprajapatii wants to merge 1 commit intomatplotlib:mainfrom
Conversation
a5bc16f to
80cd63d
Compare
|
While this maybe works (I didn't check), this will likely not fix the same issue with e.g. marker capstyles and joinstyles. A more general fix seems appropriate. |
|
As a possible more general fix, I was thinking of preserving additional marker state when creating the new Would this be a reasonable direction, or would you recommend a different approach here ? |
|
I think everything not explicitly changed should be copied. |
|
I experimented with copying additional marker state when recreating the MarkerStyle. However, some internal attributes (for example Current implementation recreates the MarkerStyle with the new fillstyle while preserving the existing Would like to know if there is a specific marker state that should also be preserved. |
|
AFAICS, Markers are immutable. Similar to |
|
I see your point about keeping markers immutable and creating a new marker with modified attributes (similar to Happy to adjust the approach based on your preference. |
|
I will unilaterally claim that this discussion is not taking place between the reviewers and the PR author, but between the reviewers and a LLM. We don't need to spend time on talking to a LLM via the Github interface -- we could just do that directly ourselves. Closing accordingly. |
|
Hii @anntzer, I'm sorry if my previous comment came across the wrong way. That wasn't my intention. I did reproduce the issue and worked on the patch locally while looking into the MarkerStyle behavior. I was trying to discuss the direction I was thinking about for the fix. |
|
@jayaprajapatii sorry in case we wrongly assumed this was AI generated. We get a lot of AI spam nowadays and it's sometimes difficult to distinguish between genuine work and blind AI usage. Please make sure to follow our AI policy. I would re-open, but the solution should towards the factory method approach, and there the code here does not help. More precisely, let's go with creating a |
|
@timhoffm Thankyou, for the clarification and for pointing me to the factory method approach. I'll look into implementing this using a |
|
Hello @timhoffm , However, when the marker is rebuilt this way, the half-filled star becomes fully filled. It looks like the |
|
@jayaprajapatii The problem is well scoped. It must be possible to solve this only based on the internals of MarkerStyle. Finding out how the implementation has to look like is part of the task. |
|
Superseeded by #31301. |

Closes #31257
Description
Calling
Line2D.set_fillstyle()recreated theMarkerStyleobject without preserving the existing user transform. As a result, markers that had a rotation transform applied lost their rotation when the fillstyle was updated.This patch recreates the
MarkerStylewith the requested fillstyle while preserving the existing_user_transform, ensuring that rotated markers retain their orientation.Testing