如何在图形的矩形中绘制由可视光谱颜色填充的矩形?
设置对象1从第一个6545图形0到第一个6580矩形的图形1填充颜色“ ????”
我在此enter link description here中找到了颜色。
该怎么做?
答案 0 :(得分:2)
如果您只需要大致的颜色印象,则可以采用以下简单,快速且肮脏的方法(仍需调整)。确保将set samples
设置得足够高,以使您有足够的impulses
且不会出现白色(背景)线。
如果您需要在另一张图中使用此频谱,请通过调整multiplot
和origin
用size
创建插图。使用help multiplot
,help origin
和help size
但是,如果您需要更精确的颜色表示,请检查您提供的链接中的链接。
代码:
### visible spectrum ("quick and dirty")
reset session
set palette defined (380 "black", 400 "dark-violet", 440 "blue", 490 '#00b0c0', 530 "green", 560 "yellow", 620 "red", 780 "black")
set samples 1000
unset colorbox
plot [380:780] '+' u 1:(1):1 w impulse lc palette notitle
### end of code
结果:
添加:
也许是这样的:
代码:
### visible spectrum ("quick and dirty")
# inserted into another plot
reset session
set palette defined (380 "black", 400 "dark-violet", 440 "blue", 490 '#00b0c0', 530 "green", 560 "yellow", 620 "red", 780 "black")
set samples 1000
unset colorbox
set multiplot
plot cos(x)+0.2*x
set origin 0.05,0.75
set size 0.45, 0.2
unset tics
plot [380:780] '+' u 1:(1):1 w impulse lc palette lw 1 notitle
unset multiplot
### end of code
结果:
另一种变化:
代码:
### visible spectrum ("quick and dirty")
# below curve
reset session
set palette defined (380 "black", 400 "dark-violet", 440 "blue", 490 '#00b0c0', 530 "green", 560 "yellow", 620 "red", 780 "black")
set samples 1000
unset colorbox
f(x) = sin((x-380)/25)*cos((x-580)/10) + 2
plot [380:780] '+' u 1:(f(x)):1 w impulse lc palette notitle, \
f(x) w l lw 2 lc rgb "black" notitle
### end of code
结果: