Reputation: 638
I tried to use an example in the demo
folder, my goal is to define a color area above and below my blue line
Here is what I get :
Code :
set style fill solid 0.50 noborder
set style data lines
set title "Fill area"
set xrange [ 250.000 : 500.000 ] noreverse writeback
## Last datafile plotted: "silver.dat"
plot 'silver.dat' u 1:2:($3+$1/50.) w filledcurves above notitle, \
'' u 1:2 w filledcurves lc rgb "light-salmon" notitle, \
'' u 1:($3+$1/50.) lt 3 lw 2 title 'linemax"
Upvotes: 1
Views: 185
Reputation: 25714
Just for the records, there is a simpler solution. Additionally, it has the advantage of allowing transparent background.
Code:
### "partially" filledcurves with transparent background
reset session
set term pngcairo transparent
set output "SO69085000.png"
$Data <<EOD
250 20 4.472136
260 20 4.472136
270 18 4.242641
280 18 4.242641
290 20 4.472136
300 12 3.464102
310 26 5.099020
320 17 4.123106
330 8 2.828427
340 6 2.449490
350 8 2.828427
360 10 3.162278
370 20 4.472136
380 14 3.741657
390 8 2.828427
400 10 3.162278
410 9 3.000000
420 8 2.828427
430 10 3.162278
440 13 3.605551
450 9 3.000000
460 5 2.236068
470 7 2.645751
480 11 3.316625
500 7 2.645751
EOD
set style fill solid 0.5 noborder
set key noautotitles
set tics out
plot $Data u 1:2 w filledcurves y=0 lc "green", \
'' u 1:($3+$1/50.):2 w filledcurves below lc "red", \
'' u 1:($3+$1/50.) w lines lt 3 lw 2 title 'linemax'
set output
### end of code
Result: (screenshot of transparent PNG in front of checkerboard background)
Upvotes: 1
Reputation: 1569
At first, it should be noted that
'' u 1:2 w filledcurves lc rgb "light-salmon" notitle, \
will be interpreted as "filledcurves closed" by default.
The filled area of the desired plot in "salmon-pink" color is the envelope of the minimum of the two curves. This curve representing the envelope cannot be represented by a single filledcurves because it switches in the middle of the data points. As a workaround, how about using two filledcurves to represent the envelope by filling the second plot with the background color (white)?
set terminal wxt
set style fill solid 0.5 noborder
set style data lines
set title "Fill area"
set xrange [ 250.000 : 500.000 ] noreverse writeback
## Last datafile plotted: "silver.dat"
plot 'silver.dat' u 1:2:($3+$1/50.) w filledcurves above notitle, \
'' u 1:($3+$1/50.) w filledcurves y=0 lc rgb "light-salmon" notitle, \
'' u 1:2:($3+$1/50.) w filledcurves below lt bgnd notitle, \
'' u 1:($3+$1/50.) w lines lt 3 lw 2 title 'linemax"
Upvotes: 1