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 v2.0.0b1 #6515

Closed
rayosborn opened this issue May 31, 2016 · 8 comments
Closed

Dotted grid lines in v2.0.0b1 #6515

rayosborn opened this issue May 31, 2016 · 8 comments

Comments

@rayosborn
Copy link

rayosborn commented May 31, 2016

After installing v2.0.0b1 into my conda installation (Mac OS X 10.11.5, Python 2.7.11, Anaconda 2.3.0), I noticed a subtle problem with dotted lines in grids. I used the following code to generate the two attached images in v1.5.1 and v2.0.0b1, respectively:

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()

If you blow up the new image, alternate dots are linked by a faint gray line, whereas the old dots are clearly separated. Overlaid on some plots, this can make the gridlines look more like dashed lines.
old-matplotlib-grid
new-matplotlib-grid

@rayosborn rayosborn changed the title Dotted lines in v2.0.0b1 Dotted grid lines in v2.0.0b1 May 31, 2016
@tacaswell tacaswell added this to the 2.0 (style change major release) milestone Jun 1, 2016
@jenshnielsen
Copy link
Member

This is caused by the changes in #5926 where we now changed the default pattern and made them scale with line-width. When the dash/dotted pattern is to small the anti aliasing causes the dots to overlap.

I still think that scaling with line width is a good idea but perhaps we should make the minimum patterns somewhat larger.

@tacaswell
Copy link
Member

The solution is to change the default dot spacing to [1.1, 1.1], PR (plus justification plots) coming.

@efiring
Copy link
Member

efiring commented Jun 6, 2016

And change the min value to 2.

@tacaswell
Copy link
Member

Under #6547 this code gives

figure_1

@afvincent
Copy link
Contributor

afvincent commented Jun 19, 2016

@tacaswell : isn't the patterns a bit flat compared to the aspect ratio of the dotted line style in the picture that you just posted on #6547? If I paste the orange dotted line with lw=1.555… from your example in #6547 over the example showing the new grid lines, here is what I get:
comparison_dotted_vs_dotted_grid
The orange dots (with ~ default lw) look much more like dots to me than the thiner black ones. I guess this is the result of combining a very thin linewidth value for the grid lines and the new scale floor of lw=2. The black ones may be a bit surprising when one asked for a dotted grid.

But anyway, for what it's worth, IMO the new grid style is better than before.

(NB: comparison picture done with Gimp, zoom is 400% and no interpolation was used.)

@tacaswell
Copy link
Member

Closing as resolved

@rayosborn Can you check the 2.0.0b2 to verify that it actually fixes this for you?

@rayosborn
Copy link
Author

It looks more consistent, and is certainly distinct from dashed. I'm not sure it really looks dotted to me - more like short-dashed. I think to look truly dotted, you probably have to have larger gaps between each dash, but I guess that is a matter of taste. I can live with this.

@fkbreitl
Copy link

fkbreitl commented Jan 30, 2017

After testing mpl 2.0.0 I realize the same problem of dotted grid lines not looking dotted as in earlier versions, but dashed.
Could you please realize a dotted appearance of grid lines and reopen this ticket.
The current style is not satisfying and a step back.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants