• GNUPLOT QA


    GNUPLOT QA

    怎样交互式执行

    terminal命令行输入gnuplot命令,进入交互模式

    image-20220123151031102

    怎样用单行命令执行

    gnuplot -e ‘cmd1;cmd2’,因为直接在term中绘图是需要-e option;

    image-20220123151425944

    gnuplot -p -e ‘cmd1;cmd2’

    弹出绘图窗口需要加-p option,只是用-e option弹窗会立刻消失,-p -e顺序不能颠倒,-pe或-ep都会报错

    image-20220123152130027

    怎样执行gnuplot’脚本‘

    gnuplot脚本没有明确的扩展格式,通常可以使用.p .plt .gnuplt作为扩展名,gnuplot -p script.plt

    image-20220123153256128

    image-20220123152704058

    怎样设置坐标轴数值范围

    • plot [x1,x1] [y1,y2] function,绘制函数时通过方括号设定x/y数值范围
    • set xrange/yrange [num1,num2],set命令设定x/y数值范围

    怎样绘制asicii字符表示的图标

    set term dumb
    

    怎样绘制并保存图像为png格式

    set term png
    
    set output “result.png”
    

    image-20220123153924255

    image-20220123154041392

    怎样设置绘图板尺寸

    set term xxx size num1,num2
    

    image-20220123154451491

    image-20220123154523549

    怎样设置输入文件数据分隔符

    gnuplot默认以空格作为数据分隔符

    gnuplot official document

    gnuplotting.org/tag/separator

    gnuplot file separator site:stackoverflow.com

    set datafile separator "char"
    

    怎样在一个绘图板绘制多个函数

    绘制的各个函数用逗号分隔

    image-20220123171857519

    怎样隐藏key

    unset key
    

    image-20220123172108823

    怎样把key放在绘图外

    set key outside
    

    image-20220123172305390

    怎样从文件读取数据绘图

    文件名用双引号括起来,using x:y, 1代表第一列x轴数据,2代表第二列y轴数据

    set term dumb
    plot "data.dat" using 1:2
    

    image-20220123170848499

    绘制第一组数据,gnuplot默认以点的方式绘图

    image-20220123171425795

    绘制多组数据

    set term dumb
    plot "data.dat" using 1:2,"data.dat" using 1:3
    

    image-20220123172636860

    怎样使用其他数据表达风格

    plot "data.dat" using 1:2 with lines,"data.dat" using 1:3 with linespoints
    

    image-20220123173528841

    plot "data.dat" using 1:2 with lines,"data.dat" using 1:3 with boxes
    

    image-20220123173730049

    怎样为数据加上title

    plot "data.dat" using 1:2 title "DATA-1" with lines,"data.dat" using 1:3 with boxes
    

    image-20220123174546125

    ## 怎样省略文件名
    

    第二个及之后的数据和第一个数据用的同一份文件可以用双引号表示

    plot "data.dat" using 1:2 title "DATA-1" with lines,"" using 1:3 with boxes
    

    怎样save/restore term

    set terminal push	#保存当前终端
    set term dumb		#切到dumb term
    set term pop		#恢复之前使用的终端
    

    怎样使用index

    文件中可能包含多组数据集,数据集的分组用两行空行区分,数据集的分组从0开始

    index {int:start}[:{int:end}][:{int:step}]
    

    image-20220123203506695

    gnuplot -e 'set term dumb;plot "index.dat" index 0 using 1:2 with lp'
    

    image-20220123203036353

    gnuplot -e 'set term dumb;plot "index.dat" index 2 using 1:2 with lp'
    

    image-20220123203142983

    gnuplot -e 'set term dumb;plot "index.dat" index 1:2 using 1:2 with lp'
    # 绘制数据集1和数据集2
    

    image-20220123203738234

    gnuplot -e 'set term dumb;plot "index.dat" index 0:2:2 using 1:2 with lp'
    # 绘制数据集0和数据集2
    

    image-20220123204117039

    怎样使用every

    数据可能是有规律的存储在文件中

    every {int:step}[::{int:start}[::{int:end}]]
    #使用两个冒号
    

    image-20220123205347503

    gnuplot -e 'set term dumb;plot "every.dat" every 2 using 1:2 with lp'
    

    image-20220123205640356

    gnuplot -e 'set term dumb;plot "every.dat" every 2::0 using 1:2 with lp'
    

    start行号缺省默认为0,所以行号从0开始

    image-20220123210136399

    gnuplot -e 'set term dumb;plot "every.dat" every 2::1 using 1:2 with lp'
    

    image-20220123210410482

  • 相关阅读:
    会计日历-自动生成脚本
    Oracle Key Flexfields Qualifiers
    Form Personalization应用总结
    UltraEdit (Ctrl + F) 查找、(Ctrl + R)替换功能失效
    FORM Save : ORA-01403 FRM-40735 ORA-06502
    EBS R12 Vision Profile default value
    EBS增加客制应用CUX:Custom Application
    TortoiseSVN设置比较工具为BeyondCompare
    开源的文件比较工具:WinMerge,KDiff3,diffuse
    C++ Operator Overloading
  • 原文地址:https://www.cnblogs.com/movit/p/15836559.html
Copyright © 2020-2023  润新知