Skip to content
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

Dotted grid lines in matplotlib v2.0.0 appear dashed #7991

Closed
fkbreitl opened this issue Jan 30, 2017 · 18 comments
Closed

Dotted grid lines in matplotlib v2.0.0 appear dashed #7991

fkbreitl opened this issue Jan 30, 2017 · 18 comments
Labels
Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.
Milestone

Comments

@fkbreitl
Copy link

As discussed in issue #6515 dotted grid lines do not appear dotted but dashed.
This has not changed in version 2.0.0.
Could you please restore the dotted appearance as seen in earlier versions?
The current appearance is not satisfying.

@dstansby
Copy link
Member

dstansby commented Jan 30, 2017

I would agree that they don't quite look dotted to me. From #6515,

import numpy as np
import matplotlib.pyplot as plt

x = np.array([1, 1, 1, 2, 2, 2, 3, 3, 3])
y = np.array([1, 2, 3, 1, 2, 3, 1, 2, 3])
a = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9])
grid = a.reshape(3, 3)

plt.imshow(grid, extent=(x.min(), x.max(), y.min(), y.max()),interpolation='bicubic')
plt.grid(linestyle='dotted')
plt.show()

For me (on current master) this currently gives:
figure_1

@tacaswell
Copy link
Member

You can configure this however you wish: http://matplotlib.org/users/dflt_style_changes.html#plot

@fkbreitl
Copy link
Author

Maybe, but people don't want to waste time fixing stuff before they can use it. Matplotlib should be provided ready for use and not misconfigured. Most people mean a dotted line if they say so. But currently they don't get it. People don't know the settings for a dotted line nor do they have time to figure it out.

@tacaswell tacaswell added this to the 2.0.1 (next bug fix release) milestone Jan 30, 2017
@tacaswell tacaswell added the Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions. label Jan 30, 2017
@tacaswell
Copy link
Member

Flagged as critical as we need to make a decision on this one way or the other.

@dopplershift
Copy link
Contributor

Yeah, I'll agree that I don't think we should really be calling those lines dotted.

@tacaswell
Copy link
Member

Clipping at 0.5 in the scaling:

so

@tacaswell
Copy link
Member

clipping at 1.0

so

@tacaswell
Copy link
Member

clipping at 1.5

so

@dstansby
Copy link
Member

dstansby commented Feb 6, 2017

I think both the 0.5 and 1 cases look good. It would also be worth checking over a range of line widths.

@tacaswell
Copy link
Member

Clipping at 1 and range of lw

so

@tacaswell
Copy link
Member

talking to @dopplershift we are going to adjust the clipping to 1.

@dstansby
Copy link
Member

dstansby commented Feb 6, 2017 via email

tacaswell added a commit to tacaswell/matplotlib that referenced this issue Feb 6, 2017
@fkbreitl
Copy link
Author

fkbreitl commented Feb 7, 2017

To me the dot frequency looks too high. Now it almost looks like a solid line. The classic version looked different. Can we not just restore the classic appearance? That was ok. See the example below.

mpl-dotted

@tacaswell
Copy link
Member

If you do not want to use the 2.0 styles, there is a classic style sheet available (the first thing documented in http://matplotlib.org/users/dflt_style_changes.html#changes-to-the-default-style ).

See http://matplotlib.org/users/dflt_style_changes.html#plot for how to selectively revert the changes to the classic patterns and disable the scaling with line width.

You can also pass a dash pattern directly to grid to get what ever pattern you want.

There is no set of defaults which will make all users of Matplotlib happy at all times, there are simply too many different use cases (and too many users). Sorry that you have a case where they do not work well, but there is more than enough flexibility in the library to get your desired outcome.

As a reminder, a vast majority of the work done on Matplotlib is done by volunteers on their own time.

@fkbreitl
Copy link
Author

fkbreitl commented Feb 7, 2017

Thank you for pointing things out.
But is there any reason to make the doted line in 2.0 not look as good as in the classic version?
I think that matplotlib should provide plots in publication quality on a professional level. That includes avoiding referee complaints about difficult to distinguish line styles. Matplotlib should make this most obvious and less number of dots for a dotted line would put it on the safer side.

@afvincent
Copy link
Contributor

If I understood correctly, the new line styles are the results of discussions from #5917 and #5926 . One of the arguments was that the dotted style had a significantly smaller visual weight than the other line styles.

@fkbreitl
Copy link
Author

fkbreitl commented Feb 7, 2017

Thanks for pointing this out.
I think also the other line styles presented there need more space. The gaps are too small.
This makes it harder to distinguish them.

@ankitkumar-pi
Copy link

You can use, ax.grid(color='r', linestyle='dotted', linewidth=2)
There are more linestyle as
linestyle_str = [
('solid', 'solid'), # Same as (0, ()) or '-'
('dotted', 'dotted'), # Same as (0, (1, 1)) or ':'
('dashed', 'dashed'), # Same as '--'
('dashdot', 'dashdot')] # Same as '-.'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.
Projects
None yet
Development

No branches or pull requests

6 participants