gnuplot(六)、gnuplot画矢量图、颜色设置、线型点型

原文链接:

https://www.xuebuyuan.com/2124565.html

http://blog.sciencenet.cn/blog-548663-783222.html

https://blog.csdn.net/u012836354/article/details/78908436

1、画矢量图

set term emf font "Times New Roman,宋体,20"<br />
set output "alive.emf"<br />
set xlabel "Time(s)"<br />
set ylabel "Number of nodes alive"<br />
set key left bottom box<br />
set grid 20<br />
set sample 1000<br />
plot "leach 10 alive.plot" title "LEACH " w lp pt 8 ps 2 lt -1, "7 alive.plot" title "LEACH-C " w lp pt 5 ps 2 lt -1, "10 alive.plot" title "SRDC " w lp pt 13 ps 2 lt -1<br />
set output

2、颜色设置-彩色系

彩色系
set k t c; plot [][-6:-1]
0 lw 20 lc rgb "white"             t"white              #ffffff = 255 255 255",
0 lw 20 lc rgb "black"             t"black              #000000 =   0   0   0",
0 lw 20 lc rgb "red"               t"1 red              #ff0000 = 255   0   0",
0 lw 20 lc rgb "light-red"         t"light-red          #f03232 = 240  50  50",
0 lw 20 lc rgb "dark-red"          t"dark-red           #8b0000 = 139   0   0",
0 lw 20 lc rgb "green"             t"2 green            #00ff00 =   0 255   0",
0 lw 20 lc rgb "light-green"       t"light-green        #90ee90 = 144 238 144",
0 lw 20 lc rgb "dark-green"        t"dark-green         #006400 =   0 100   0",
0 lw 20 lc rgb "seagreen"          t"seagreen           #c1ffc1 = 193 255 193",
0 lw 20 lc rgb "web-green"         t"web-green          #00c000 =   0 192   0",
0 lw 20 lc rgb "sea-green"         t"sea-green          #2e8b57 =  46 139  87",
0 lw 20 lc rgb "spring-green"      t"spring-green       #00ff7f =   0 255 127",
0 lw 20 lc rgb "dark-spring-green" t"dark-spring-green  #008040 =   0 128  64",
0 lw 20 lc rgb "forest-green"      t"forest-green       #228b22 =  34 139  34",
0 lw 20 lc rgb "dark-olivegreen"   t"dark-olivegreen    #556b2f =  85 107  47",
0 lw 20 lc rgb "greenyellow"       t"greenyellow        #a0ff20 = 160 255  32",
0 lw 20 lc rgb "chartreuse"        t"chartreuse         #7cff40 = 124 255  64",
0 lw 20 lc rgb "dark-chartreuse"   t"dark-chartreuse    #408000 =  64 128   0",
0 lw 20 lc rgb "blue"              t"3 blue             #0000ff =   0   0 255",
0 lw 20 lc rgb "light-blue"        t"light-blue         #add8e6 = 173 216 230",
0 lw 20 lc rgb "medium-blue"       t"medium-blue        #0000cd =   0   0 205",
0 lw 20 lc rgb "dark-blue"         t"dark-blue          #00008b =   0   0 139",
0 lw 20 lc rgb "midnight-blue"     t"midnight-blue      #191970 =  25  25 112",
0 lw 20 lc rgb "skyblue"           t"skyblue            #87ceeb = 135 206 235",
0 lw 20 lc rgb "web-blue"          t"web-blue           #0080ff =   0 128 255",
0 lw 20 lc rgb "royalblue"         t"royalblue          #4169e1 =  65 105 225",
0 lw 20 lc rgb "steelblue"         t"steelblue          #306080 =  48  96 128",
0 lw 20 lc rgb "slateblue1"        t"slateblue1         #8060ff = 128  96 255",
0 lw 20 lc rgb "cyan"              t"4 cyan             #00ffff =   0 255 255",
0 lw 20 lc rgb "light-cyan"        t"light-cyan         #e0ffff = 224 255 255",
0 lw 20 lc rgb "dark-cyan"         t"dark-cyan          #00eeee =   0 238 238",
0 lw 20 lc rgb "magenta"           t"5 magenta          #ff00ff = 255   0 255",
0 lw 20 lc rgb "light-magenta"     t"light-magenta      #f055f0 = 240  85 240",
0 lw 20 lc rgb "dark-magenta"      t"dark-magenta       #c000ff = 192   0 255",
0 lw 20 lc rgb "yellow"            t"6 yellow           #ffff00 = 255 255   0",
0 lw 20 lc rgb "dark-yellow"       t"dark-yellow        #c8c800 = 200 200   0",
0 lw 20 lc rgb "yellow4"           t"yellow4            #808000 = 128 128   0",
0 lw 20 lc rgb "gold"              t"gold               #ffd700 = 255 215   0",
0 lw 20 lc rgb "goldenrod"         t"goldenrod          #ffc020 = 255 192  32",
0 lw 20 lc rgb "light-goldenrod"   t"light-goldenrod    #eedd82 = 238 221 130",
0 lw 20 lc rgb "dark-goldenrod"    t"dark-goldenrod     #b8860b = 184 134  11",
0 lw 20 lc rgb "navy"              t"7 navy             #000080 =   0   0 128",
0 lw 20 lc rgb "purple"            t"8 purple           #c080ff = 192 128 255",
0 lw 20 lc rgb "mediumpurple3"     t"mediumpurple3      #8060c0 = 128  96 192",
0 lw 20 lc rgb "orange"            t"orange             #ffa500 = 255 165   0",
0 lw 20 lc rgb "dark-orange"       t"dark-orange        #c04000 = 192  64   0",
0 lw 20 lc rgb "orange-red"        t"orange-red         #ff4500 = 255  69   0",
0 lw 20 lc rgb "orangered4"        t"orangered4         #801400 = 128  20   0",
0 lw 20 lc rgb "brown"             t"brown              #a52a2a = 165  42  42",
0 lw 20 lc rgb "brown4"            t"brown4             #801414 = 128  20  20",
0 lw 20 lc rgb "sandybrown"        t"sandybrown         #ffa060 = 255 160  96",
0 lw 20 lc rgb "pink"              t"pink               #ffc0c0 = 255 192 192",
0 lw 20 lc rgb "light-pink"        t"light-pink         #ffb6c1 = 255 182 193",
0 lw 20 lc rgb "dark-pink"         t"dark-pink          #ff1493 = 255  20 147",
0 lw 20 lc rgb "aquamarine"        t"aquamarine         #7fffd4 = 127 255 212",
0 lw 20 lc rgb "turquoise"         t"turquoise          #40e0d0 =  64 224 208",
0 lw 20 lc rgb "light-turquoise"   t"light-turquoise    #afeeee = 175 238 238",
0 lw 20 lc rgb "dark-turquoise"    t"dark-turquoise     #00ced1 =   0 206 209",
0 lw 20 lc rgb "beige"             t"beige              #f5f5dc = 245 245 220",
0 lw 20 lc rgb "lemonchiffon"      t"lemonchiffon       #ffffc0 = 255 255 192",
0 lw 20 lc rgb "khaki"             t"khaki              #f0e68c = 240 230 140",
0 lw 20 lc rgb "khaki1"            t"khaki1             #ffff80 = 255 255 128",
0 lw 20 lc rgb "dark-khaki"        t"dark-khaki         #bdb76b = 189 183 107",
0 lw 20 lc rgb "olive"             t"olive              #a08020 = 160 128  32",
0 lw 20 lc rgb "honeydew"          t"honeydew           #f0fff0 = 240 255 240",
0 lw 20 lc rgb "bisque"            t"bisque             #cdb79e = 205 183 158",
0 lw 20 lc rgb "antiquewhite"      t"antiquewhite       #cdc0b0 = 205 192 176",
0 lw 20 lc rgb "tan1"              t"tan1               #ffa040 = 255 160  64",
0 lw 20 lc rgb "sienna1"           t"sienna1            #ff8040 = 255 128  64",
0 lw 20 lc rgb "sienna4"           t"sienna4            #804014 = 128  64  20",
0 lw 20 lc rgb "salmon"            t"salmon             #fa8072 = 250 128 114",
0 lw 20 lc rgb "light-salmon"      t"light-salmon       #ffa070 = 255 160 112",
0 lw 20 lc rgb "dark-salmon"       t"dark-salmon        #e9967a = 233 150 122",
0 lw 20 lc rgb "coral"             t"coral              #ff7f50 = 255 127  80",
0 lw 20 lc rgb "light-coral"       t"light-coral        #f08080 = 240 128 128",
0 lw 20 lc rgb "orchid"            t"orchid             #ff80ff = 255 128 255",
0 lw 20 lc rgb "orchid4"           t"orchid4            #804080 = 128  64 128",
0 lw 20 lc rgb "violet"            t"violet             #ee82ee = 238 130 238",
0 lw 20 lc rgb "dark-violet"       t"dark-violet        #9400d3 = 148   0 211",
0 lw 20 lc rgb "plum"              t"plum               #dda0dd = 221 160 221",
0 lw 20 lc rgb "dark-plum"         t"dark-plum          #905040 = 144  80  64"

3、颜色设置-灰色系

灰色系
set k t c; plot [][-6:-1]
0 lw 20 lc rgb "gray"             t"gray               #bebebe = 190 190 190",
0 lw 20 lc rgb "grey"             t"grey               #c0c0c0 = 192 192 192",
0 lw 20 lc rgb "light-gray"       t"light-gray grey    #d3d3d3 = 211 211 211",
0 lw 20 lc rgb "dark-gray"        t"dark-gray grey     #a0a0a0 = 160 160 160",
0 lw 20 lc rgb "slategray"        t"slategray grey     #a0b6cd = 160 182 205",
0 lw 20 lc rgb "gray0"            t"gray0   grey0      #000000 =   0   0   0",
0 lw 20 lc rgb "gray10"           t"gray10  grey10     #1a1a1a =  26  26  26",
0 lw 20 lc rgb "gray20"           t"gray20  grey20     #333333 =  51  51  51",
0 lw 20 lc rgb "gray30"           t"gray30  grey30     #4d4d4d =  77  77  77",
0 lw 20 lc rgb "gray40"           t"gray40  grey40     #666666 = 102 102 102",
0 lw 20 lc rgb "gray50"           t"gray50  grey50     #7f7f7f = 127 127 127",
0 lw 20 lc rgb "gray60"           t"gray60  grey60     #999999 = 153 153 153",
0 lw 20 lc rgb "gray70"           t"gray70  grey70     #b3b3b3 = 179 179 179",
0 lw 20 lc rgb "gray80"           t"gray80  grey80     #cccccc = 204 204 204",
0 lw 20 lc rgb "gray90"           t"gray90  grey90     #e5e5e5 = 229 229 229",
0 lw 20 lc rgb "gray100"          t"gray100 grey100    #ffffff = 255 255 255"

     

4、默认颜色

        默认的7种颜色有时候不够用, 可以利用lc rgb进行自定义, 更方便的是利用set style line命令. 下面定义了与Origin默认一致的颜色.

set style line 1 lc rgb "black"
set style line 2 lc rgb "red"
set style line 3 lc rgb "green"
set style line 4 lc rgb "blue"
set style line 5 lc rgb "cyan"
set style line 6 lc rgb "magenta"
set style line 7 lc rgb "yellow"
set style line 8 lc rgb "dark-yellow"
set style line 9 lc rgb "navy"

5、线型点型

        在NS2的gnuplot绘图程序中对线型(linetype)、点型(pointtype)、线条宽度(linewidth)、点大小(pointsize)、图样(style)都有相应的设定值,具体设置如下:

(1)线型(linetype )。在此类型中主要设置线条的颜色,具体对应如下:

n

0

1

2

3

4

5

6

linetype

black

red

green

blue

pink

浅蓝

yellow

(2)点型(pointtype)。此类型用于设置点得形状,可分为14中,具体对应如下:

n

0

1

2

3

4

5

6

7

8

9

10

11

12

13

pointtype

+

×

*

(3)线宽(linewidth)、点大小(pointsize)。两者都可以设置为整数或小数。

(4)图样(style):gnuplot 描绘数据数据图形是以读入档案中的坐标值后,以图样绘上。gnuplot可提供9种图样,分别是:

        lines : 将相邻的点以线条连接。如 plot sin(x) with lines。

        points : 将每一点以一符号绘上。如 plot sin(x) with points

        linespoints : 同时具有lines 及 points 的功能。

        impulses : 将每一点画一垂直线至X 轴。如 plot sin(x) with impulses。

        dots : 将每一点绘一细点。如plot sin(x) with dots。

        steps : 以垂直线及水平线各一条来连接两点,形成梯形。如连接 (x1,y1),(x2,y2)两点,以(x1,y1)到(x2,y1)和(x2,y1)到(x2,y2) 两线段连接。如 plot sin(x) with steps。

        errorbars : 对每一点坐标值(x,y),画一由 (x,ylow) 至(x,yhigh) 的线段。并在线段两端做上 tic mark。如plot sin(x) with errorbars。

        boxes : The boxes style draws a box centred about the given x coordinate from the yaxis to the given y coordinate.如plot sin(x) with boxes。

        boxerrorbars : 组合errorbars 与 boxes 两者功能。如 plot sin(x) with boxerrorbars。

  • 5
    点赞
  • 10
    收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
©️2022 CSDN 皮肤主题:数字20 设计师:CSDN官方博客 返回首页
评论
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值