-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
[ENH]: dashed hatching pattern #27170
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
this looks pretty and also reasonable, but also this is pushing more in the direction of custom hatch #20690 |
Yes, I can see it now. I didn't realize there's a similar request in the pipeline already. |
Both? I think this in particular is clear enough that it could be an out of the box style, but I have no idea what the unambiguous short notation would be since |
How about |
it won't work with our current parsing scheme, which allows infinite repetition of any character in the set '-+|/\xXoO.*' matplotlib/lib/matplotlib/hatch.py Lines 182 to 188 in b34e704
but now I'm thinking this would also be nice in vertical and diagonal and thinking that "DashedHatch" might be a good place to prototype a custom hatch object since it's scoped pretty clean? Using any of the classes specified in https://github.com/matplotlib/matplotlib/blob/main/lib/matplotlib/hatch.py#L14 as a model? |
Any two character sequence is tough, and any sequence that includes an extant character is even tougher, as hatch patterns use repetitions to increase density, and do so irrespective of their ordering, etc. (They just do I think I do think that some of the finer points of the example above may be challenging without a more extensive refactor of hatching (which isn't to say not its not worthwhile, but is to say it may be a larger task than originally expected)
I agree that the example looks nice and if we could capture that it would be good, I just expect that what we would implement now would be potentially more rigid looking: e.g. here is what I got by just hacking the dash pattern in the svg backend (not threading it through anywhere, etc, just was trying to get an idea, was using the branch from #27158 as my starting point because the example there is analogous to the example here in a way): Note how all the dashes/gaps are aligned vertically.. I suspect that many of the "easy" ways to implement this idea will have that in common. I'm less concerned with the fact that this example does not scale the lines/gaps inversely to density, I think that is relatively easy to do . |
Problem
I've recently seen a plot with a dashed hatching style and was wondering if there's a case for adding such a style to matplotlib? Especially that we've got dotted hatching already available and this seems to be similar.
Source: https://twitter.com/DataVizStefan/status/1714930118781530248/photo/1
Proposed solution
I don't have the exact solution but matplotlib allows to create all sorts of fancy edge line styles so I'd imagine the technical ability of the library to implement this request is there.
https://matplotlib.org/stable/gallery/lines_bars_and_markers/linestyles.html
The text was updated successfully, but these errors were encountered: