1

I'm using plt.colormesh overtop of an image. When I turn down the alpha of plt.colormesh so that the image shows through, plt.colormesh creates a griding effect due to the overlap in the edges. To be accurate there is no overlap in the points, but the density of the points and large scale causes the points to share space.

Example: plt.colormesh alpha 1.0

Full opacity

plt.colormesh alpha 0.5

Gridding

https://stackoverflow.com/a/27096694/4435344 suggestions: 300 dpi, no edges, face color, no linewidth

highres

Previous plot plus antialiased=True antialiased

akozi
  • 425
  • 1
  • 7
  • 20
  • The main option that I'm considering is to swap the order of the layers. By putting the map ontop and turning the alpha down of the google maps instead of the data. The only downside of this is that the map of northern Canada would show up faintly without data behind it. – akozi Jun 05 '20 at 15:08
  • Also considering moving this to the geospatial data stack, but I feel this may be appropriate here. – akozi Jun 05 '20 at 15:08
  • 2
    This might be relevant? https://stackoverflow.com/questions/27092991/white-lines-in-matplotlibs-pcolor – DavidG Jun 05 '20 at 15:12
  • @DavidG I just tried the suggested changes from that thread, as well as increasing the figure size, and it was unable to fix the issue. – akozi Jun 05 '20 at 15:27
  • @DavidG I'll try the second answer. This does seem like a duplicate thread at the moment. – akozi Jun 05 '20 at 15:30
  • @DavidG Yes adding `antialiased=True` essentially solved the problem to where it is not as noticable. Link or close the question? – akozi Jun 05 '20 at 15:32
  • 1
    I add `rasterized=True` to avoid this problem when I save the plot as a pdf file – Smectic Jun 05 '20 at 15:34
  • Thanks, everyone. I'm tempted to find the minimal solution that fixes this. I ultimately added a half dozen lines. I added `rasterized=True, linewidth=0, antialiased=True` to `plt.colormesh`. `binned_plot.set_edgecolor('face')` after the call and `figsize=figsize, dpi=figdpi` to the `savefig` command. – akozi Jun 05 '20 at 15:38

0 Answers0