【问题标题】:Unique line line of a 2D cut with gnuplot使用 gnuplot 进行二维切割的独特线条
【发布时间】:2022-11-17 02:50:21
【问题描述】:

请让我的 2D 切割具有独特的黑线。


set terminal png size 800,800 font 'Times New Roman, 12'
set output 'TH1.png'
set view map
set pm3d map
unset surface
set cont base
set cntrparam levels 50
set isosamples 10
unset key 
set xrange[0:180]
set yrange[0:180]
set xlabel '{/Symbol q}'
set ylabel '{/Symbol q}''
set palette rgb 33,13,10
splot 'TH1TH2.dat' w ima, 'TH1TH2.dat' w l lt -4 lw 1.6

对于大于 2000 的值,我想要红色。 有人能帮我吗? 我无法粘贴数据,因为它太大了。 这是我的 2D cut 但我只想有黑线。

link for the data

【问题讨论】:

    标签: gnuplot gnuplot-iostream


    【解决方案1】:

    如果我们可以使用原始数据(可能最小化),那将是理想的。不管怎样,下面的例子创建了它自己的数据。 如果您需要进一步的解释,请告诉我。

    脚本:

    ### contour lines with custom colors
    reset session
    
    set pm3d
    set contour 
    set cntrparam levels 20
    
    ### create some test data
    set table $Data
        set isosamples 100
        set samples 100
        f(x,y)=(sin(1.3*x)*cos(.9*y)+cos(.8*x)*sin(1.9*y)+cos(y*.2*x))*4000/3.+2000
        splot [-5:5][-5:5] f(x,y)
    unset table
    
    set palette rgb 33,13,10
    set size ratio 1
    unset key
    set tics out
    set view map
    set xrange[:] noextend
    set yrange[:] noextend
    
    myColor(v) = v>=2000 ? 0xff0000 : 0x000000
    
    plot $Data index 0 u 1:2:3 w image, 
            '' index 1:999 u 1:2:(myColor($3)) w l lc rgb var
    ### end of script
    

    结果:

    【讨论】:

    • 是否可以用黑色绘制所有线条?我有 03 列
    • @Herve 是的,使用'' index 1:999 u 1:2 w l lc "black"。但是,“对于大于 2000 的值,我想要红色”是什么意思?
    • 我附上数据
    • 我的意思是高于 2000 的值必须是红色的
    猜你喜欢
    • 1970-01-01
    • 2018-05-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-11-16
    • 1970-01-01
    • 1970-01-01
    • 2014-09-08
    相关资源
    最近更新 更多