0

I've produced a plot showing a best fit value and one with error estimate included (the dashed yellow line). I want to shade the region between the best fit value and this yellow line. As can be seen, the gnu plot filler I use is not optimal and leaves a residual jaggy effect and the shaded region does not extend all the way to the yellow curve. What might causes this and is there a way, within gnu plot, to allow for an improved filling?

I use the following gnu plot code to generate shaded region

plot 'data.dat' u 1:($18+$19):($18-$19) w filledcurve ls 999 fs solid 0.12 bo notitle,\ 

enter image description here

CAF
  • 329
  • 3
  • 14
  • 1
    Please specify your gnuplot version and in particular the terminal type used to produce the plot. Is that a screenshot? From what viewing program? There is, for example, a long history of pdf viewers that generate this kind of artifact even though the file content produces glitch-free output on other viewers or on a printer. – Ethan Jul 19 '19 at 16:50
  • @Ethan I see, thanks. I am using gnu plot version 5.0 (patch level 5). I set to output the plot as a .eps file that I can then open in command line (just by keying in open xxx.eps). The screenshot of the plot is a screenshot of the .eps file. Is there an alternative way that might produce better rendering? – CAF Jul 19 '19 at 16:58
  • OK. The bad news is that you will probably get these artifacts from version 5.0 for either eps or direct pdf output. The good news is that the filled curve treatment changed in version 5.2 so this shouldn't happen any more. A possible work-around using version 5.0.5 (I tested it here) is to display the plot in either the qt or wxt terminal, then use the "Export to File" widget to save a pdf copy. The pdf file can be converted to eps if need be. – Ethan Jul 19 '19 at 17:54
  • I see. So you suggest instead of outputting a .eps, I write ‘set term wxt’ with ‘set output xxx.pdf’ instead? I don’t have access at the moment to give it a go. – CAF Jul 19 '19 at 18:02
  • Not quite. "set output" will do nothing. There is a clickable Export to File widget at the top left of the plot window for both the wxt and qt terminals. – Ethan Jul 19 '19 at 18:19
  • Oh I see. Thanks very much. Actually I tried it now but the window opens and then immediately closes. I’ve tried -persist as is usually done but the window does not remain open... do you know if there is something stronger than -persist that would work? – CAF Jul 19 '19 at 18:24
  • What command are you using? Are you doing something other than typing these commands in to the gnuplot prompt? – Ethan Jul 19 '19 at 19:50
  • I’ve changed the set terminal line and set output to xxx.pdf in my script. Otherwise in the command line I’m just compiling via gnuplot file.plot. But because I set terminal to wxt, I can see a flash of the window but it disappears. Using gnuplot -persist file.plot doesn’t help for me. – CAF Jul 19 '19 at 19:57
  • Either run gnuplot interactively and execute your script using `load "scriptname"` or from the command line use `gnuplot scriptname -`, where the trailing hyphen will leave it in interactive mode after executing the script. – Ethan Jul 19 '19 at 20:02
  • Thanks! that worked...although the jagged artefacts remain..I thought maybe it could be a problem with display on a log plot but I removed that and the problem persists. Strange. – CAF Jul 19 '19 at 21:10
  • The actual suggestion was to upgrade to version 5.2! See my answer https://stackoverflow.com/a/18954245/2604213 for an explanation of the actual problem. – Christoph Jul 23 '19 at 04:28
  • @Christoph yup I have tried this too but it didn’t improve the plot at all unfortunately - do you have any other suggestions for what might be causing the jagged filling? Bring back the days when we could just use felt tip pens :P – CAF Jul 26 '19 at 14:53

0 Answers0