-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
[Bug]: offset dash linestyle has no effect in patch objects #22977
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Upon digging deeper into this issue it appears that this actually the intended behavior: matplotlib/lib/matplotlib/patches.py Line 588 in f8cd2c9
So it might be prudent to just update the docstring to reflect this fact. I'm curious why this was made the default behavior though |
replacing the 0 here with the passed offset works completely fine on my OSX and Ubuntu setups. matplotlib/lib/matplotlib/patches.py Line 590 in f8cd2c9
|
@oliverpriebe Why do you want to do this? On one hand, we will sort out how to manage changing behavior when we need to, but on the other hand we need to have a very good reason to change long-standing behavior! |
I'd like to use edge colors (red/blue) to denote a binary property of an entity represented by a rectangular patch that may overlap exactly with another entity with the opposite property value. When they overlap I'd like to easily see the two colors -- which isn't possible by just using low alphas. Admittedly this is both a niche use case and can be worked around by hacking the onoffseq as so
|
but it might save the next poor soul some time if the docstring was updated |
I couldn't find a reason why we should ignore dash offset here. If this was intended, we should issue a warning if the user sets a non-zero value. However I rather think this was an oversight and even though noticed, nobody bothered to take action. matplotlib/lib/matplotlib/patches.py Line 588 in d1f6b76
This is a niche feature that almost nobody will use. But AFAICS, there's little harm in supporting offests here. The only user code we could break with that is if users would explicitly have set an offset but rely on it not being applied. That's not something we'd have to guard against. To me this is simply a bug (affecting very little users), and we could fix it right away. |
Marking this as good first issue as there is a minor modification required. Most work will be related to tests, probably an equality test with the workaround and the fixed code, and writing a sensible user release note clarifying that this has been fixed. |
Bug summary
When setting the linestyle on a patch object using a dash tuple the offset has no effect.
Code for reproduction
Actual outcome
the patch edge lines overlap, not adhering to the offset.
Expected outcome
Haven't been able to get any patch objects to have a proper offset on the edge line style but the expected outcome is shown here with Line2D objects
Additional information
I have tried the Ellipse patch object as well and found the same issue. I also reproduced in Ubuntu 18.04 VM running matplotlib 3.5.0 with agg backend.
Operating system
OS/X
Matplotlib Version
3.3.4
Matplotlib Backend
MacOSX
Python version
Python 3.8.8
Jupyter version
No response
Installation
conda
The text was updated successfully, but these errors were encountered: