如何在gnuplot中设置标签和行相同的颜色 [英] how to set label and line the same color in gnuplot
问题描述
很简单的东西。我想要一个函数,说函数f,用特定的颜色绘制。我还想要一个标签说功能f颜色,也显示在那种颜色。
我试试这个到目前为止:
设置样式行1 lw 3 lc 1
在0,70设置标签ACtextcolor 1
但显然lc和textcolor遵循不同的规格,并且抱怨:
trolo4.pl,第8行:colorspec选项无法识别
任何帮助将是伟大的!
@holygeek的答案工作正常。来自python,我发现通常更好一些更明确。
设置样式行1 lw 1 lc rgb red
在0时设置标签AC,70 tc rgbred
注意,你的gnuplot识别的颜色名称是系统依赖的(参见 show colornames
一个完整的列表)。要实现完全的系统独立性,可以使用 #RRGGBB
版本。例如红色是'#ff0000
,绿色是#00ff00
,蓝色是#0000ff
。当然,你可以组成各种有趣的颜色(再次,请参阅 show colornames
获取预定义颜色及其等效#的列表。 .... )
更多信息,请参见 help colorspec
p>
Very simple stuff. I want a function, say function f, to be plotted with a particular color. I also want a piece of label saying "function f color" which is also displayed in that color.
I am trying this so far:
set style line 1 lw 3 lc 1
set label "AC" at 0, 70 textcolor 1
but apparently the "lc" and "textcolor" follows different specs, and it complains:
"trolo4.pl", line 8: colorspec option not recognized
any help would be great!
The answer by @holygeek works fine. Coming from python, I find that it is often nice to be a little more explicit.
set style line 1 lw 1 lc rgb "red"
set label "AC" at 0, 70 tc rgb "red"
Note that the set of color names recognized by your gnuplot is system dependent (see show colornames
for a complete list). To achieve complete system independence, you can use the #RRGGBB
version. e.g. red is '#ff0000
, green is #00ff00
and blue is #0000ff
. of course, you can make up all sorts of interesting colors (again, see show colornames
for a list of pre-defined colors and their equivalent #.....
)
for more info, also see help colorspec
这篇关于如何在gnuplot中设置标签和行相同的颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!