Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

hist2d stripes when saving as pdf

I am plotting a 2d histogram with matplotlib. When I save it as a pdf file, stripes can be seen (not when I see it directly on the spyder IDE, for example).

I am opening it with okular and atril and the problem is there in both cases. You can find the picture attached (the green lines are part of the plot. But the white stripes should not be there).

The stripes are not there if I save the file as png, for example.

Any ideas or suggestions?

enter image description here

like image 237
xkudsraw Avatar asked Sep 20 '25 04:09

xkudsraw


1 Answers

In addition to what other people have suggested in the comments, you could also add to the call of the hist2d function the following piece:

edgecolor='face'

which changes the color of the border of every bin to match that of the bin's face.

like image 151
BlackPhoenix Avatar answered Sep 22 '25 08:09

BlackPhoenix