why does texstudio internal PDF viewer shows streak white lines on image?

The image is composed of triangles. The following image is generated from the PDF file. First the page stream of the file is uncompressed by:

 pdftk image.pdf cat output image-uncompress.pdf uncompress

Then the file is modified by replacing " m B" by " m S" and " m f" by " m S". The replacement of B and f by S removes the filling and the triangles are drawn only.

enter image description here

As can be seen the white lines collide with borders between triangles. Thus, maybe it is a rounding issue.


My usual approach to circumvent this problem is to export such images in multiple layers.

  • One layer which only contains the coloured histogram, no axis nore text. This file will be saved as .png thus circumventing the viewer artefacts at the edges of bins.

enter image description here

  • The next layer contains all lines and text. This layer will be saved as .pdf

enter image description here

  • Both layers can be combined in several ways. You could use inkscape or directly do it in latex and use a picture environment to stack the images.

enter image description here

(For histograms with a very large number of bins, this approach will also dramatically reduce the file size and speeds up rendering of the .pdf)


This is an issue which was common to several versions of Mathematica, though strangely I can't reproduce it using Mathematica 11 (on Linux, not Windows). It happens when vector graphics are shaded using polygons (as is the case here), but the outlines of the polygons are omitted. To fix the issue, export your image as eps (you can convert to pdf later), by enclosing your ContourPlot command in an Export command:

Export[ "myfile.eps" , Contourplot[ ... ] ] 

Then, open up the eps file in your favourite text editor, and find the macro which is used to fill polygons. This will be near the top of the file, and will probably be something like

/f { fill bind def }

or perhaps

/f fill load def

Change fill to gsave fill grestore stroke and save the file. The new instruction tells the viewer to shade the polygons and draw their outlines. After reloading in your viewer, you should find that the issue is gone.