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.
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With