Xrange在填充透明图中的问题

时间:2019-08-23 15:19:58

标签: gnuplot transparency xrange

在以下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

我遇到的问题是set xrange [2:200],情节发生了变化,并像这样向上填充了曲线,

enter image description here

我想知道如何像在第一幅图中那样使用默认范围并设置xrange [2:20]来保持曲线下方的填充。

1 个答案:

答案 0 :(得分:2)

“带有填充曲线”允许许多变体。请参阅help filledcurves的文档。默认值为with filledcurves closed,它尝试使用这些点来定义包围周围区域的周长。如果曲线超出图的边缘,则使用图的边缘完成周边。如您所见,有时程序选择的边缘不是您想要的。

要控制它,请使用其他变体之一。在这种情况下,您可能需要with filledcurves y=0,它将y = 0处的线定义为周长的一部分。

... 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