Benjamin Root <ben.root@...553...> writes:
It seems that savig a pcolor plot to a pdf format always includes
gridlines, which isn't true for other output formats like png. The
attached example demonstrates this problem. I've only tested this on
version 1.1.1rc1.I have reported something like this before, and it seems that it is
dependent upon the PDF viewer and i's settings. Particularly, the
antialiasing settings. I have seen this with gs-based viewers. Have you
tried others?
I see gridlines in the resulting image in gs, xpdf Preview.app but not
in Adobe Reader. When I zoom in Preview, the lines jump around a bit,
and are always the same width on the screen regardless of zoom level.
What gets drawn in this example is a lot of polygons, so that adjacent
polygons share an edge with the exact same coordinates. The code fills
the inside of each polygon, and apparently some rendering algorithms
leave a minimal-width line between polygons.
Making the polygons overlap by one pdf unit (1/72 of an inch) seems to
make the lines go away at least in Preview. Making them overlap by 0.1
units does not help.
I don't think this can be fixed purely in the pdf backend; it just gets
a path collection and draws each polygon. I suppose pcolor would need to
pad the polygons a little, but could it cause problems with other
backends or use cases? (E.g. if you use alpha blending, neighboring
rectangles might get gridlines of a darker color where they overlap.)
I wonder if drawing zero-width lines between neighboring rectangles,
e.g. taking the color always from the left or the upper rectangle, would
work. In matplotlib a line of zero width means no line at all, but in
the pdf file format it means a line of the smallest possible width,
which might work well for filling in a missing line of that same
width. This would need some kind of special-casing in the graphics
context (because linewidth=0 means to not draw a line) so it's not
completely trivial to try it out.
A different approach would be to output a raster image from pcolor and
render it with large pixels. I don't know how well that would work with
Agg, though.
···
--
Jouni K. Sepp�nen