1

I'm having problems in plotting with pdfcairo what I was making with wxt terminal in gnuplot.

The code I use for wxt is:

set term wxt 0 size 1000,562
set pm3d map
set size 0.9
splot 'XYZpm3d.dat'

and this gives something like:

while in pdfcairo I write:

set term pdf color size 25cm,14cm
set out 'plot.pdf'
set pm3d map
set size 0.9
splot 'XYZpm3d.dat' palette
set out

And I get something like:

How can I fix the colour saturation problem? It doesn't affect the colorbar or the text, and it also does not happen if the splot is splot (x*x+y)/100 instead of that of the data file. It also seems the problem arises when using map.

Andrestand
  • 156
  • 1
  • 1
  • 16

1 Answers1

1

This is not a saturation effect, but an antialiasing problem of the many tiny rectangles which splot draws, see the beginning of my answer to problematic Moire pattern in image produced with gnuplot pm3d and pdf output.

The best way to overcome this problem is to plot with image, which plots your data as bitmap, which is what you actually also have. This however requires equally spaced values in x and y:

set term pdf color size 25cm,14cm
set out 'plot.pdf'
set size 0.9
set autoscale fix
plot 'XYZpm3d.dat' with image
set out

It you don't have equally spaced values it becomes quite involved to get a proper image, see problematic Moire pattern in image produced with gnuplot pm3d and pdf output or Big data surface plots: Call gnuplot from tikz to generate bitmap and include automatically? on TeX.SX.

Community
  • 1
  • 1
Christoph
  • 47,569
  • 8
  • 87
  • 187
  • Well, in fact I am not sure if the problem is what you say (your code makes a white plot, so I may have not equally spaced values), but it is of course due to gnuplot. I am now checking that this difference of "saturation" in the final result is only visible in some pdf viewers, like PDF Exchange Viewer, but not for example in Acrobat, or in the TexMaker one, where I can see the plot as it might be. The question now would be about what is going to happen when printing it in paper... – Andrestand Nov 04 '13 at 10:43
  • I've read your answer to the Moire pattern problem, @Christoph, and I see then that the 'true' output is the one I see with pdf exchange viewer, due tu the thin line enhance in Acrobat. It's going to be difficult for me to use your method. I started using pm3d due to [this other issue about filling the whole space](http://stackoverflow.com/questions/17967664/gnuplot-filling-the-whole-space-when-plotting-sampled-data), so I have to start again. Thanks anyway! – Andrestand Nov 04 '13 at 10:58
  • 1
    @Andrestand I'm pretty sure, that it is this very same problem. Try zooming in the pdf, you should see it better then. I don't know why you get a white plot, the format used by `pm3d` is suitable also for `image`. Can you upload a sample data file somewhere, or show how the file is formatted? If your values are not equally spaced, you'll simply get wrong scalings, because every 'pixel' of the final images has the same size, but you should see something (unless you have some other settings). Did you `reset` before plotting? – Christoph Nov 04 '13 at 11:00
  • Yes, zooming I saw the problem you mention ;) And now I have checked the data and it works! Thanks a lot. – Andrestand Nov 04 '13 at 11:52
  • @Andrestand Does it work now with the `image` plotting style? I have very similar images I use this plotting style for: http://i.stack.imgur.com/0k2cU.png :) – Christoph Nov 04 '13 at 12:01
  • It works with the exact code you wrote above, although I wont use `autoscale fix`. We may be working in very similar propagation phenomena... ;) – Andrestand Nov 04 '13 at 12:15