Search code examples
latexgnuplot

Cairolatex terminal produces bitmap output


I am using gnuplottex in Overleaf to write a document using the IEEETran document style. When I plot filledcurves the result kind of bad as it seems not to be in a vector graphics format; thus getting pixelated upon zooming into the figure. Additionaly, some weird white boxes are floating around hideing parts of a label.

I developed the figure locally on my machine using the cairopdf terminal and Gnuplot 5.4. The first picture show the resulting pdf of of Latex using the cairolatex terminal. The second picture shows a very deep zoom in the test pdf done with the cairopdf terminal where everything looks good.

set style fill transparent solid 0.35 noborder
plot for[i=1:num_states] normal(x, word(means, i), word(std, i)) notitle with filledcurves y1=0

What is going on? I read that epslatex has some trouble with transparency is that here also the case?

Bad figure from latex with buggs Test figure done with cairopdf


Solution

  • The PostScript language itself (including *.eps) does not support transparency or alpha-channel colors. So no *.ps or *.eps file can portray transparent/translucent areas properly. At best it can be approximated by using some intermediate representation that does handle alpha channels and then translating the final resulting blended colors to PostScript, but that means later color balance adjustments made during viewing or printing will not preserve the correct balance in the blended areas.

    There should be no problem with pdf. I don't know what caused that partial white rectangle. Maybe if you show a more complete script that created the figure?

    Edited:

    Using set terminal cairolatex pdf in gnuplot should solve the pixelation and transparency issues. You can create a new question if the unwanted white rectangles persist.