仓库源文站点原文


layout: post title: gnuplot颜色设置 categories:


2014-04-06 20:38:52

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

彩色系

<pre class="line-numbers" data-start="0"><code class="language-bash"># Language: bash 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" </code></pre>

灰色系

<pre class="line-numbers" data-start="0"><code class="language-bash"># Language: bash 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" </code></pre>

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

<pre class="line-numbers" data-start="0"><code class="language-bash"># Language: bash 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" </code></pre>