-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
[WiP] ENH: Add a “loose” version of the dashed line styles #8048
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
[WiP] ENH: Add a “loose” version of the dashed line styles #8048
Conversation
Seems this didn't get much traction; maybe a post on the list might garner some views? Now that line width clipping is gone, what is your current stance on this change? |
Huh, sorry @QuLogic, just notice your post now... (The notification is likely to have sunk in my inbox 🐑) I still think that this could be an interesting feature, but it needs to be better formalized before going any further. I think that it might be worth giving a shot at the the devel-list to try getting traction. I am also wondering about a trick that @anntzer made in #10244 . For the moment, simply re-milestoning it for 3.0, with the hope that I will manage to find time to be a bit more active on this in the next few months... |
Feel free to re-assign the milestone if you get back to this... |
Since this Pull Request has not been updated in 60 days, it has been marked "inactive." This does not mean that it will be closed, though it may be moved to a "Draft" state. This helps maintainers prioritize their reviewing efforts. You can pick the PR back up anytime - please ping us if you need a review or guidance to move the PR forward! If you do not plan on continuing the work, please let us know so that we can either find someone to take the PR over, or close it. |
I think the main question here is just whether we can find a reasonably syntax for user-specified dashes. My guess is "yes, as long as we don't try to support them in the plot shorthand syntax" (which is carefully designed to minimize confusion between color/marker/linestyle, but even then the introduction of the data kwarg made things awkward as the shorthand can also be data kwarg entries). So closing for lack of activity, but I think there are ways to revisit this if there's interest. |
Rationale
Several tickets pointed out that the defaults dashed line styles have a “frequency” that is too high (#7991), especially when using a “dotted” style for grid lines (#6515). This PR aims at introducing a “loose” version of these dashed line styles, in the spirit of what had been suggested in #7087 . Coupled to sane defaults (still to be found/discussed), “casual users” (or myself :) ) could have access in an easy fashion to “less frequently” dashed lines. And “power-users” could even tweak these additional dash patterns in their matplotlibrc file to get a fast & easy access to supplementary dash patterns.
PS: not sure if it belong to the “API Changes” flag, so feel free to remove if it does not…
Implementation
Three new rcParams are added:
lines.dashed@loose_pattern
,lines.dashdot@loose_pattern
andlines.dotted@loose_pattern
. Currently, they are similar to the rcParamslines.dashed_pattern
,lines.dashdot_pattern
andlines.dotted_pattern
but with off inks parts that have been tripled in length. This specific value can of course be discussed.One can now use these three new line styles by adding “@Loose” after the line style “ID string”. Here is for example the case for loosely dotted lines:
ax.plot(…, linestyle="dotted@loose")
ax.plot(…, linestyle=":@loose")
ax.plot(…, ":@looseob") # MATLAB-style
(yes, it starts to become verbose/hard to read…)Feel free to suggest anything better than using the suffix “@Loose” to specify that one wants a loosely dashed line style.
Still to be done
Line2D
docstring inmatplotlib.lines
test_linestyle_variants
intests/test_lines.py
(I do not really understand how this test works: it looks like an image test but does not have the@image_comparison
decorator)Example
A small example of what it does currently looks like:
Script source:
Edit: typo…