强制执行轮廓范围并反转颜色标签

时间:2017-04-19 10:22:23

标签: colors gnuplot contour

我使用以下脚本

set term pngcairo font ",18" enh size 1400,1400                                                                                                                                                                                              
set view map                                                                                                                                                                                                                                 
set key at screen 1, 0.9                                                                                                                                                                                                                     
unset surface                                                                                                                                                                                                                                
set contour base                                                                                                                                                                                                                             
set cntrparam levels incremental 0.00, 0.06, 2                                                                                                                                                                                               
#                                                                                                                                                                                                                                            
set linetype 2  lc rgb "#8F2FFF"                                                                                                                                                                                                             
set linetype 3  lc rgb "#8F2FFF"                                                                                                                                                                                                             
set linetype 4  lc rgb "#8F2FFF"                                                                                                                                                                                                             
set linetype 5  lc rgb "#2F30FF"                                                                                                                                                                                                             
set linetype 6  lc rgb "#2F30FF"                                                                                                                                                                                                             
set linetype 7  lc rgb "#2F8EFF"                                                                                                                                                                                                             
set linetype 8  lc rgb "#2F8EFF"                                                                                                                                                                                                             
set linetype 9  lc rgb "#2FFFD6"                                                                                                                                                                                                             
set linetype 10 lc rgb "#2FFFD6"                                                                                                                                                                                                             
set linetype 11 lc rgb "#35FF2F"                                                                                                                                                                                                             
set linetype 12 lc rgb "#35FF2F"                                                                                                                                                                                                             
set linetype 13 lc rgb "#FEFF2F"                                                                                                                                                                                                             
set linetype 14 lc rgb "#FEFF2F"                                                                                                                                                                                                             
set linetype 15 lc rgb "#FFAF2F"                                                                                                                                                                                                             
set linetype 16 lc rgb "#FFAF2F"                                                                                                                                                                                                             
set linetype 17 lc rgb "#FF362F"                                                                                                                                                                                                             
set linetype 18 lc rgb "#FF362F"                                                                                                                                                                                                             
set xra[0.:12]                                                                                                                                                                                                                               
set yra[0.:12]                                                                                                                                                                                                                               
set xtics out nomirror                                                                                                                                                                                                                       
set ytics axis in offset -4.0,0 nomirror                                                                                                                                                                                                     
set out "foo.png"                                                                                                                                                                                                                            
splot sin(x) * cos(y) w l lw 4

获取下图 enter image description here

我现在的问题是虽然我使用了set cntrparam levels incremental 0.00, 0.06, 2但仍然获得了最大轮廓值0.96。谁能告诉我如何强制gnuplot将轮廓范围固定到2。第二个问题是:是否可以反转颜色标签顺序,使其从较低值开始到较高值?换句话说,我希望gnuplot在洋红色线的标签顶部显示零值,依此类推,直到标签底部的红线最高值。

1 个答案:

答案 0 :(得分:2)

函数sin(x)*cos(y)1从上面限定,因此你获得的最大轮廓水平为0.96,因为下一个将是1.02(步长为0.06),但是没有实际值x,y的{​​{1}}对应于这个假设的轮廓。

至于图例中标题的顺序,set key invert似乎没有效果。但是,您可能只是颠倒Gnuplot构造轮廓线的顺序,即使用

set cntrparam levels incremental 0.96, -0.06, 0
set isosamples 1000,1000 #to get smoother contours...

而不是set cntrparam levels incremental 0.00, 0.06, 2