如何在Gnuplot中为增量定义的等高线添加离散临界等高线
Gnuplot添加临界等高线报错:All points of colorbox value undefined
我需要为通过set cntrparam levels increment命令定义的等高线集合添加一条临界等高线。原本打算用set cntrparam levels discrete实现添加,但该命令会覆盖原有等高线,不符合需求。我编写了Windows环境下的Gnuplot脚本尝试修改,运行后出现**"All points of colorbox value undefined"**错误提示,相关脚本及数据文件如下:
问题脚本
reset session set grid x,y front set xrange noextend set yrange noextend stats "datos0.txt" u 3 nooutput set zrange [STATS_min:STATS_max] set dgrid3d 900,900 qnorm 9 set contour set view 0,0,1 v = 7; w = 0.1 * int((STATS_max-STATS_min-0.2)*10./(v-1.)) # MODIFICATION: THE NEXT 3 LINES ARE REPLACED BY THE FOLLOWING 11 LINES #set cntrparam levels incremental STATS_min+0.1,w,STATS_max-0.1 ## IF THE FOLLOWING 'IF' SENTENCE IS TRUE, THE PRECEEDING CONTOUR LEVELS ARE ALL REPLACED BY JUST ONE DISCRETE LEVEL #if ((((STATS_max-STATS_min-0.2) - int(STATS_max-STATS_min-0.2))/w) >= 0.5) { set cntrparam levels discrete STATS_max-0.1} # create level string and sort it by value set table $Temp set samples v plot '+' u (STATS_min+0.1+$0*w) w table if ((((STATS_max-STATS_min-0.2) - int(STATS_max-STATS_min-0.2))/w) >= 0.5) { plot '+' every ::::0 u (STATS_max-0.1) w table} set table $Levels plot $Temp u 1:0 smooth freq # sort levels unset table myLevels = '' stats $Levels u (myLevels = myLevels.($0==0?'':', ').strcol(1)) nooutput set cntrparam level discrete @myLevels set palette rgbformulae 33,13,10 set cbrange[STATS_min:STATS_max] set cbtics 0.2 set colorbox vertical user origin 0.93,0.38 size .02,.585 # THESE 3 LINES, THOUGH USELESS, ARE NECESSARY TO AVOID AN 'undefined value' ERROR MESSAGE WHEN EXECUTING THE LAST 3 LINES OF THE SCRIPT set table $qq splot "datos0.txt" unset table set cntrlabel format "{/:Bold %.1f}" font "Times-New Roman, 10" onecolor set lmargin set origin -0.373,-0.375 set size 1.735,1.74 # VALE 1.034 per la umid. e 1.023 per il vento # Use a coarser grid when generating labels # use a dummy definition g = $smallgrid() to force a single execution of a function that resets the grid parameters function $smallgrid() << EOF set dgrid3d 95,95 qnorm 9 EOF set pm3d explicit splot "datos0.txt" with pm3d, \ '' with lines lw 1 lc "black" nosurface, \ g=$smallgrid() '' with labels pointnumber 1
数据文件(datos0.txt)
0 66 0.2 0 69 0.3 0 70 0.3 0 72 0.7 0 74 0.1 0 74.1 0.1 0 79 0.3 0 80 0.2 0 81 0.3 0.1 61 -0.1 0.1 70 0.3 0.1 74 0.7 0.1 75 0.8 0.1 75.1 0.3 0.1 78 0.2 0.2 73 0.4 0.2 75 0.5 0.3 59 0.5 0.3 74 0.4 0.3 75 0.1 0.3 76 0.6 0.3 78 0.2 0.4 71 0.3 0.4 73 0.4 0.4 74 0.6 0.5 54 1.1 0.5 69 0.2 0.5 76 0.6 0.5 84 0.3 0.6 55 0.3 0.6 67 0.3 0.6 68 0.4 0.6 76 0.4 0.6 77 0.5 0.6 79 0.2 0.6 80 0.4 0.7 68 0.2 0.7 72 0.1 0.7 73 0 0.7 76 0.4 0.7 76.1 0.4 0.7 77 0.5 0.7 77.1 0.3 0.7 81 0.2 0.8 46 1 0.8 54 0.1 0.8 63 0.5 0.8 68 0.3 0.8 73 -0.1 0.8 74 0.3 0.8 78 0.3 0.8 81 0.3 0.8 82 0.2 0.9 50 0.8 0.9 56 0.5 0.9 60 1.2 0.9 65 0.3 0.9 70 0.7 0.9 74 0.2 0.9 79 0 0.9 80 0.2 0.9 80.1 0.1 1 69 0.4 1 76 0.5 1 81 0.2 1.1 54 0.3 1.1 73 0.1 1.1 76 0.3 1.1 76.1 0.4 1.1 81 0.2 1.2 56 0 1.2 75 0.3 1.2 79 0.1 1.3 68 0.3 1.3 75 0.3 1.3 82 0.3 1.4 46 0.2 1.4 66 0.7 1.4 71 0.2 1.4 78 0 1.4 81 0.3 1.4 81.1 0.4 1.5 45 0.9 1.5 60 1.3 1.5 71 0.1 1.5 76 0.1 1.5 82 0.2 1.5 82.1 0.2 1.5 82.2 0.2 1.5 84 0.2 1.6 55 0.9 1.6 57 1.4 1.6 71 0 1.6 81 0.1 1.6 82 0.1 1.6 83 0.1 1.6 84 0.3 1.7 62 0.3 1.7 66 1 1.7 75 0.4 1.7 76 0.3 1.7 78 0.3 1.7 78.1 0.1 1.7 80 0.1 1.7 84 0.3 1.8 56 0.3 1.8 63 0.3 1.8 67 0.6 1.8 69 0.3 1.8 77 0.1 1.8 77.1 0.4 1.8 78 0.3 1.8 79 0.3 1.8 84 0.2 1.9 49 0.2 1.9 53 0.3 1.9 53.1 0.3 1.9 54 0.2 1.9 79 0.1 1.9 82 0.3 1.9 84 0.3 2 60 1 2 68 0.2 2 73 0.5 2 77 0.2 2.1 45 1 2.1 61 0.6 2.1 66 0.4 2.1 82 0.1 2.2 61 0.1 2.2 64 0.2 2.3 64 0.5 2.3 70 0.2 2.3 76 0.1 2.4 73 0.1 2.5 53 0.2 2.5 68 -0.1 2.5 74 0.1 2.5 79 0.1 2.6 43 0.9 2.6 65 0.8 2.6 70 0.1 2.8 61 0.4 2.9 61 0.5 3 54 0.4 3.1 69 0.2 3.2 57 0.3 3.2 67 0.4 3.5 65 1.1 3.8 54 0.3 3.8 60 0.2 3.9 53 0.6 3.9 65 0 4.1 46 0.9 4.1 48 0.8 4.2 56 0.8 4.3 43 1.1 4.3 45 1.1 4.6 44 1 4.7 44 0.7 4.7 46 0.9 4.7 52 0.7 5.5 44 0.9 6.6 70 -0.5
脚本原本预期根据条件判断,输出单等高线标签或增量等高线标签两种结果,但修改后的方案出现上述报错。
内容的提问来源于stack exchange,提问作者ifffam
相关产品推荐
相关产品推荐

