Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gnuplot filledcurves with palette

I have been trying to change the fillstyle for the filledcurves option in gnuplot so that the fill colour represents the difference between the two curves on a 2-dimensional plot. I am thinking of this as an extension of the 'filledcurves above/below' option whereby instead of just having two colours representing above or below there is a colour range or palette.

Here is an example of the plot I would like to make from a datafile using the above/below filled curve style. A colourbar representing the y-difference between the two curves would be very useful.

http://i.stack.imgur.com/RLlpU.png

I have tried to do this by adding a fourth column to the using command i.e.

plot 'data.txt' using 1:2:3:($3-$2) with filledcurves fs palette

but the filledcurves does not appear to accept the fourth column... I have also considered trying rgb variable but this doesn't seem to work either.

like image 675
atstack Avatar asked Nov 22 '12 13:11

atstack


1 Answers

Yet Another Solution

If the pm3d 2D map is allowed without filledcurves, then the following code could be used to achieve this

In the data processing part, the grid data for splot is constructed from the original input data. The color of the fill area is determined by the z-value given for splot.

set table $first
plot "test.dat" using 1:2:($3-$2) with table
set table $second
plot "test.dat" using 1:3:($3-$2) with table
unset table

set print $data
do for [i=1:|$first|] {
  print $first[i]
  print $second[i]
  print ""
}
set print

set yrange [-2:2]
set palette define (-1 "skyblue", 0 "gray90", 1 "pink")

splot $data using 1:2:3 with pm3d 
like image 74
binzo Avatar answered Sep 28 '22 09:09

binzo