gnuplot(九)、gnuplot画矢量与颜色设置

本文详细介绍了如何使用gnuplot软件绘制矢量图,并提供了具体的代码示例。此外,还深入探讨了gnuplot中预定义颜色的设置方法,展示了多种颜色的名称及其对应的RGB值。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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

参考链接:

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

2、颜色设置

        gnuplot作图时默认颜色7种, 命令show colorname 显示预定义颜色有112种, 但去除重复后, 实际预定义的不同颜色只有97种. 下面的代码可以显示出所有预定义的颜色名称。

 

 

 

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"  

 

 

 

 

 

 

 

 

彩色系
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"

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值