user1993416
user1993416

Reputation: 768

Problem with xrange in fill transparent plot

In the following Gnuplot:

set xlabel "Network size, m [r]" font " Helvetica,17"
set ylabel "Algorithms computation time [s]" font "Helvetica,17"

$t500 << EOD
1   0   0   0   
2   0.00933135  0.0640543   0.215254    
3   0.00954345  0.0746418   0.416871    
4   0.009779    0.0853093   0.621712    
5   0.0101225   0.0958813   0.822831    
6   0.0106212   0.106193    1.02248 
7   0.0114236   0.11658 1.22483 
8   0.0126996   0.128502    1.42843 
9   0.0150443   0.138803    1.62994 
10  0.0193814   0.149177    1.83284 
11  0.0282591   0.159563    2.0358  
12  0.0450926   0.170019    2.24009 
13  0.0791815   0.180668    2.44586 
14  0.146265    0.191207    2.65134 
15  0.284757    0.201806    2.85782 
16  0.556054    0.212695    3.0671  
17  1.11529 0.223592    3.27625 
18  2.22795 0.234535    3.4873  
19  4.55297 0.245686    3.69976 
20  9.02265 0.257064    3.91294 
EOD

set key spacing 1.0
set key top left font "Helvetica, 17"
#set xrange [2:20]
#set yrange [0.001:1000]
set logscale y
set grid
set terminal pdfcairo transparent enhanced 
set style function filledcurves y1=0
set ytics ("0" 0.001,"0.01" 0.01,"0.1" 0.1,"1" 1,"10" 10,"100" 100)
unset colorbox
set style fill transparent solid 0.2  border
set bmargin 3.5
set out "program500.pdf"
plot [][] '$t500' using 1:2 title 'S computation' w filledcurves lc rgb "forest-green",\
'$t500' using 1:($2+$3) title 'S computation + Stability computation' w filledcurves  lc rgb "violet",\
'$t500' using 1:($2+$4) title 'S computation + Max joint flow computation' w filledcurves  lc rgb "gold"

enter image description here

The problem I have is set xrange [2:200] the plot changes and fills the curves upwards, like this,

enter image description here

I would like to know how to keep the filling below the curves as in the first plot with the default ranges and setting xrange [2:20].

Upvotes: 0

Views: 47

Answers (1)

Ethan
Ethan

Reputation: 15093

"with filledcurves" allows many variants. See the documentation for help filledcurves. The default is with filledcurves closed, which tries to use the points to define a perimeter enclosing a surrounded area. If the curve runs off the edge of the plot, the edges of the plot are used to complete the perimeter. As you found, sometimes the edges chosen by the program are not the ones you wanted.

To control this, use one of the other variants. In this case you probably want with filledcurves y=0, which defines the line at y=0 as part of the perimeter.

... initial lines as above ...
set xrange [2:20]
plot'$t500' using 1:2 title 'S computation' w filledcurves y=0 lc rgb "forest-green",\
'$t500' using 1:($2+$3) title 'S computation + Stability computation' w filledcurves y=0 lc rgb "violet",\
'$t500' using 1:($2+$4) title 'S computation + Max joint flow computation' w filledcurves y=0 lc rgb "gold"

enter image description here

Upvotes: 2

Related Questions