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 have different individual dot sizes in pdf files #9780

ViaFerrata opened this issue Nov 14, 2017 · 3 comments


None yet
4 participants
Copy link

commented Nov 14, 2017

Hello there,

I've a problem with drawing dotted grid lines that are saved in pdf files.
The grid is drawn with plt.grid(True, zorder=0, linestyle='dotted').

I've attached a pdf file that demonstrates the issue:
If you look at the dotted grid line with 300% Zoom, the single dots in the grid have different sizes (some are thicker, some are thinner).
However, if you apply a higher zoom (e.g. 800%), you can see that suddenly, all of the dots have the same size.

I've tried different pdf viewers (Ocular, Adobe Reader, Evince), but the result stayed the same.
As a result, I guess that this has something to do with the rendering of the grid in pdf files, since the shape of the dots is correct in very high zooms.

Any idea?

Zoom 300%, different dot size Zoom 800%, same dot size

The pdf file:

Matplotlib version

  • Operating system: Ubuntu 16.04
  • Matplotlib version: 2.1.0 installed with pip
  • Matplotlib backend (print(matplotlib.get_backend())): TkAgg
  • Python version: 2.7.13

This comment has been minimized.

Copy link

commented Nov 15, 2017

This is inherent in vector-based file formats--you are at the mercy of the renderer and the available resolution of the output device. I don't think there is anything matplotlib can do to improve the situation, so I am closing this.

@efiring efiring closed this Nov 15, 2017


This comment has been minimized.

Copy link

commented Nov 15, 2017

@ViaFerrata Defining a default grid custom linestyle with more space between the dots (with the grid.linestyle rcParam) might be a reasonable workaround if this issue with PDF rendering is really a problem for your use case. You can find an example of how to do this in the 2.1 What's new list.


This comment has been minimized.

Copy link

commented Nov 15, 2017

If you have access to Acrobat turn off image smoothing and line smoothing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.