-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
API: change the dot patterns #6547
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
Conversation
How does the new scale floor of |
It's only 0.5/1.5 = 1/3 larger at 1.5? But you are right that we should check all of the default patterns. import numpy as np
import matplotlib.pyplot as plt
from cycler import cycler
import matplotlib
th = np.linspace(0, 32)
fig, ax = plt.subplots()
lins_styles = ['dashed', 'dotted', 'dashdot']
cy = cycler(matplotlib.rcParams['axes.prop_cycle'])
for j, (ls, sty) in enumerate(zip(lins_styles, cy)):
for lw in np.linspace(.5, 10, 10):
ax.plot(th, j*np.ones(50) + .1 * lw, linestyle=ls,
label=str((ls, lw)), lw=lw, **sty)
ax.legend() |
@jenshnielsen You're right, I didn't take into account that previously the scale was already 1.5. So indeed the impact of the new PR shouldn't be that important. |
@@ -897,7 +897,7 @@ def validate_hist_bins(s): | |||
'lines.solid_capstyle': ['projecting', validate_capstyle], | |||
'lines.dashed_pattern': [[2.8, 1.2], validate_nseq_float()], | |||
'lines.dashdot_pattern': [[4.8, 1.2, 0.8, 1.2], validate_nseq_float()], | |||
'lines.dotted_pattern': [[1.2, 0.6], validate_nseq_float()], | |||
'lines.dotted_pattern': [[1.1, 1.1], validate_nseq_float()], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the line above, I expect the second half of the dashdot pattern should match the dot pattern, or if anything, should be even a little more stretched out along the line. The 0.8 can go to 1.2.
@afvincent That seems like a reasonable approach to me. One concern is that the pattern now scales with linewidth so picking the length for the legend gets tricky. |
That said... if the problem about the scaling the pattern to the linewidth On Thu, Jun 9, 2016 at 8:26 AM, Thomas A Caswell notifications@github.com
|
We could scale the length of each handle also by lw, but then if you have On Thu, Jun 9, 2016, 09:35 Benjamin Root notifications@github.com wrote:
|
My genuine proposition was simply to have a set of name "dash" styles that are congruent, and show an integer number of "patterns¹" with the default linewidth. Doing that, people that play only with the colors and the markers would have more regular legend handles. And for the others who play also with the named dash styles, they could simply increase the handle length to match something better (like for example the "lowest common multiple" of "patterns"), if they want to. And for the hardcore ones who also use user-defined dash styles, well the new situation wouldn't be worse or better than before... For the record, my first guess was that a default handle length of 2 "patterns" would be nice, because I was thinking that if lw=1 corresponds to N=2 "patterns", then lw=2 would be OK for N=1 "pattern" with the same handle length. But then I saw that the default lw is 1.5 and the new scale floor is lw=2 so this cannot work this way... I didn't even bother trying to propose something about tuning the length of the handle, as I expect that a consensus about what would be the better default behavior may be difficult to achieve. ¹ : beware it's not really a "pattern" (meaning a period)! It's just that I find that the case were the handles have ink on both ends more pleasant to the eye. So for example the handle for the dashdot would have a length of N*(dash + blank + dot). |
dot: 1.2, 1.2 |
This will address #6515. |
6bc0adf
to
7468bba
Compare
Updated to use the patterns @efiring listed. Re-running @jenshnielsen 's |
👍 from me. This all seems very well-reasoned. Closed/opened to force Travis to rerun -- not sure why that one failure only on Python 2.7 is appearing. |
- change the dotted pattern to [[1.1, 1.1]] - change scale floor to a lw of 2.0
7468bba
to
7a203e4
Compare
similar failures in py2.7, 3.4 and 3.5. A whole bunch of them, too. |
5dccd1b
to
13b8c91
Compare
Restored the masking for non-'classic' style sheet, will update the images in another PR. |
Does this still need to be done? |
That is #6757 which is failing and I have not sorted out why yet. |
The lines in these test imagee have a different dash style now due to matplotlib#6547.
The lines in these test imagee have a different dash style now due to matplotlib#6547.
These settings were discussed with @efiring and @jenshnielsen
Some of the test images (+ source) are below.