【问题标题】:Define pointtype using `word` command in gnuplot在 gnuplot 中使用 `word` 命令定义点类型
【发布时间】:2020-01-31 09:41:14
【问题描述】:

我正在使用相同的线型 (ls 1) 绘制多个数据文件。但是,我想在下面的代码中使用 wrd_pt 中包含的不同点类型来区分数据。

结果如图所示,其中 GNUPLOT 将变量 wrd_pt 中包含的值绘制为 pointtype,而不是与每个数字关联的符号(正方形、三角形、...)。我正在使用 GNUPLOT 5.0 并且无法更新它(我不是我正在使用的计算机的 sudoer)以使用数组,例如5.2版的。

有谁知道我该如何解决这个问题?

[... initializing ...]
wrd_pt ="5 7 9 11 13 15"
[... some other piece of code ...]
set output "plot_1a.eps"
    plot for [i=1:words(fspo_one)] work_dir.word(fspo_one, i) u 1:5 w lp ls 1 pt word(wrd_pt, i) ps 1 notitle
unset output 

【问题讨论】:

    标签: gnuplot


    【解决方案1】:

    为什么不使用绘图样式with labels?也适用于 gnuplot 5.0。

    类似这样的:

    代码:

    ### point types as string from a string
    reset session
    
    wrd_pt = "5 7 9 11 13 15"
    
    set xrange[0:10]
    set style textbox opaque
    
    set samples 10
    plot for [i=1:words(wrd_pt)] '+' u 1:(i*$1**2) w l lw 2 notitle, \
         for [i=1:words(wrd_pt)] '+' u 1:(i*$1**2):(word(wrd_pt,i)) w labels boxed notitle
    
    ### end of code
    

    结果:

    【讨论】:

    • 嗬!我没有考虑到这一点。太好了。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-12-08
    • 2018-09-28
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多