Gert Gottschalk
Gert Gottschalk

Reputation: 1716

Gnuplot transparent shaded area between curves

I have a data set with mean and standard deviation columns. I can plot mean+sigma and mean-sigma curves above and below the mean. Now I want light shading between the +-sigma but still see the mean curve. I've tried the below transparent setting but still no success.

 set style fill transparent solid 0.5 noborder
 plot 'inter.dat' using 1:2 with linespoints lc "black", \
      'inter.dat' using 1:($2-$3)  with linespoints lc "blue", \
      'inter.dat' using 1:($2+$3)  with linespoints lc "blue", \
      'inter.dat' using 1:($2-$3):($2+$3) with filledcurves lc "skyblue" fs solid 0.5

Sample data:

 0.490  -5.809   +2.203 
 0.500  -1.293   +1.370 
 0.520  -1.026   +0.979 
 0.530  -0.877   +0.961 
 0.540  -0.656   +0.937 
 0.550  -0.878   +0.923 
 0.560  -0.649   +0.876 
 0.570  -0.729   +0.859 
 0.580  -0.370   +0.771 
 0.590  -0.421   +0.710 

Your feedback is appreciated.

Upvotes: 2

Views: 5695

Answers (1)

user8153
user8153

Reputation: 4095

You specify transparent in your first fillstyle declaration, but essentially override that in the plot command. You can do either

set style fill transparent solid 0.5 noborder
plot 'inter.dat' using 1:2 with linespoints lc "black", \
     'inter.dat' using 1:($2-$3)  with linespoints lc "blue", \
     'inter.dat' using 1:($2+$3)  with linespoints lc "blue", \
     'inter.dat' using 1:($2-$3):($2+$3) with filledcurves lc "skyblue" 

or

plot 'inter.dat' using 1:2 with linespoints lc "black", \
     'inter.dat' using 1:($2-$3)  with linespoints lc "blue", \
     'inter.dat' using 1:($2+$3)  with linespoints lc "blue", \
     'inter.dat' using 1:($2-$3):($2+$3) with filledcurves lc "skyblue" fs transparent solid 0.5

to get

enter image description here

Also, keep in mind that not all terminals support transparency; the above image was generated using pngcairo.

Upvotes: 4

Related Questions