gnuplot使用2

设置图中连线的颜色、宽度、连线样式等

set style line

每个显示终端都有默认的线类型和点类型集合,可以通过在命令行输入: test查看,如下图显示了在wxt终端模式下默认的线的集合和点的集合

set style line命令定义了一组线的类型和宽度及点的类型集合,方便后面通过索引号来调用,而不用每次都输入一遍set style line命令来设置。

Syntax:

      set style line <index> default
      set style line <index> {{linetype  | lt} <line_type> | <colorspec>}
                             {{linecolor | lc} <colorspec>}
                             {{linewidth | lw} <line_width>}
                             {{pointtype | pt} <point_type>}
                             {{pointsize | ps} <point_size>}
                             {{pointinterval | pi} <interval>}
                             {palette}
      unset style line
      show style line

default 参数设置具有相同索引号的线风格为默认值,如set style line 5 default意思是设置索引号为5的线的风格为 默认的风格

线的风格包括:

1、线的类型linetype简写为lt,默认的linetype如下图

2、线的颜色:linecolor简写为lc,后面跟的值为:

where <colorspec> has one of the following forms:

      rgbcolor "colorname"    # e.g. "blue"
      rgbcolor "0xRRGGBB"     # string containing hexadecimal constant
      rgbcolor "0xAARRGGBB"   # string containing hexadecimal constant
      rgbcolor "#RRGGBB"      # string containing hexadecimal in x11 format
      rgbcolor "#AARRGGBB"    # string containing hexadecimal in x11 format
      rgbcolor <integer val>  # integer value representing AARRGGBB
      rgbcolor variable       # integer value is read from input file
      palette frac <val>      # <val> runs from 0 to 1
      palette cb <value>      # <val> lies within cbrange
      palette z
      variable                # color index is read from input file
      bgnd                    # background color
      black

3、线的宽度:linewidth、点的风格:pointtype、pointsize等同样的道理,可以查询具体的可选值

例如:在命令行输入 plot 'datafile.dat' w linespoint ,显示如下图

输入: plot 'datafile.dat' w linespoint lt 2表示使用2号linetype线型,显示如下图

该图显示的是默认的linetype 2的风格,如果想改变线的颜色,则可以在命令后面继续跟上lc ‘red’

在命令行提示符后面输入:plot 'datafile.dat' w linespoint lt 2 lc 'red',则lc参数覆盖了默认lt显示线的颜色,如下图

当然也可以改变线的宽度、点的类型等

输入:plot 'datafile.dat' w linespoint lt 2 lc 'red' lw 2 pt 3

 

可以看到线的宽度、点的类型都变了,其他想设置什么自己练练吧

 

 

 

原文地址:https://www.cnblogs.com/zkwarrior/p/5817738.html