如何在GNUPLOT中制作彩虹盒

如何在GNUPLOT中制作彩虹盒,gnuplot,Gnuplot,我想用普朗克分布曲线在可见光区域制作一个彩虹填充的盒子。 我不知道如何用彩虹填充这个盒子 我放了一个盒子 set object 1 rectangle from 3600,0 to 8200,3.6 fs solid 0.4 及 是用来上色的。 但我唯一能做的就是用一种颜色填充它 我看到了一些用于绘图的彩色演示,比如pm3d或一些调色板, 但它不会把它们放在带有调色板的obj着色上 来自维基,我想要彩虹盒: 去年我真的想画出完全相同的图。我找不到一个gnuplot解决方案(我很确定它是存在的…

我想用普朗克分布曲线在可见光区域制作一个彩虹填充的盒子。 我不知道如何用彩虹填充这个盒子

我放了一个盒子

set object 1 rectangle from 3600,0 to 8200,3.6 fs solid 0.4

是用来上色的。 但我唯一能做的就是用一种颜色填充它

我看到了一些用于绘图的彩色演示,比如pm3d或一些调色板, 但它不会把它们放在带有调色板的obj着色上

来自维基,我想要彩虹盒:

去年我真的想画出完全相同的图。我找不到一个
gnuplot
解决方案(我很确定它是存在的…),最后我用
awk
部分编写了一个脚本,生成了一个波长范围内带有RGB颜色的文件,然后在
gnuplot
中用
脉冲lc RGB变量
绘制这些文件。我使用了一些问题中的代码,但记不起原始来源。无论如何,请使用下面的代码:

#!/bin/bash

        seq 4000 1 7000 | awk '{
            wv=$1/10
            if(wv < 380){
                    rd = -(380. - 440.) / (440. - 380.)
                    gr = 0.0
                    bl = 1.0}
            if(wv >= 380 && wv < 440){
                    rd = -(wv - 440.) / (440. - 380.)
                    gr = 0.0
                    bl = 1.0}
            if(wv >= 440 && wv < 490){
                    rd = 0.0
                    gr = (wv - 440.) / (490. - 440.)
                    bl = 1.0}
            if(wv >= 490 && wv < 510){
                    rd = 0.0
                    gr = 1.0
                    bl = -(wv - 510.) / (510. - 490.)}
            if(wv >= 510 && wv < 580){
                    rd = (wv - 510.) / (580. - 510.)
                    gr = 1.0
                    bl = 0.0}
            if(wv >= 580 && wv < 645){
                    rd = 1.0
                    gr = -(wv - 645.) / (645. - 580.)
                    bl = 0.0}
            if(wv >= 645 && wv <= 730){
                    rd = -(wv - 780.) / (780. - 645.)
                    gr = 0.0
                    bl = 0.0}
            if(wv > 730){
                    rd = -(730 - 780.) / (780. - 645.)
                    gr = 0.0
                    bl = 0.0}
            rgb=int(255*rd)*2^16+int(255*gr)*2^8+int(255*bl)
            printf("%7.4f %f %f %f %f %3d %3d %3d %10d\n",$1/10000,41,rd,gr,bl,rd*255,gr*255,bl*255,rgb)
        }' > rgb.tmp



gnuplot << GNU

set term pdf size 7,7 font "courier,16"
set output 'bblaw.pdf'
set encoding iso
set border -1 lw 0.90
set tics front


set style line 1 pt 7 ps 1.50 lt -1 lw 2.5 lc "#608DB6CD"
set style line 2 pt 5 ps 1.50 lt -1 lw 2.5 lc "#60EE6363"
set style line 3 pt 9 ps 1.00 lt -1 lw 2.5 lc "#FFB90F"
set style line 4 pt 5 ps 1.50 lt -1 lw 2.5 lc "#EEEEEE"

set xrange [0.10:1.65]
set yrange [0:41]

set  ytics 5
set mytics 5
set  xtics 0.25
set mxtics 5
set format x "%4.2f"

set ylabel "Intensity (kW . sr^{-1} . m^{-2} . {/Symbol m}m^{-1})"
set xlabel "Wavelength ({/Symbol m}m)"

set label "5000K"       at 0.50,14.0 front font ",15"
set label "5500K"       at 0.45,21.5 front font ",15"
set label "5778K (Sun)" at 0.40,27.0 front font ",15"
set label "6000K"       at 0.45,32.5 front font ",15"
set label "8000K"       at 0.22,39.0 front font ",15"

unset key

# length unit is micrometre
c=3e14 # speed of light
h=6.626e-22 # Planck constant
k=1.38e-11 # Boltzmann constant

# Planck curves
p1(x)=1e-6*2*h*c**2/(x**5*(exp(h*c/(x*k*5000))-1))
p2(x)=1e-6*2*h*c**2/(x**5*(exp(h*c/(x*k*5500))-1))
p3(x)=1e-6*2*h*c**2/(x**5*(exp(h*c/(x*k*5778))-1))
p4(x)=1e-6*2*h*c**2/(x**5*(exp(h*c/(x*k*6000))-1))
p5(x)=1e-6*2*h*c**2/(x**5*(exp(h*c/(x*k*8000))-1))

plot "rgb.tmp" u 1:2:9 not w imp lc rgb variable lw 0.5,\
     p1(x) lw 6, p2(x) lw 6, p3(x) lw 6, p4(x) lw 6, p5(x) lw 6

GNU

rm rgb.tmp
#/bin/bash
seq 4000 1 7000 | awk'{
wv=$1/10
如果(wv<380){
rd=-(380.-440.)/(440.-380.)
gr=0.0
bl=1.0}
如果(wv>=380&&wv<440){
rd=-(wv-440.)/(440.-380.)
gr=0.0
bl=1.0}
如果(wv>=440&&wv<490){
rd=0.0
gr=(wv-440.)/(490-440.)
bl=1.0}
如果(wv>=490&&wv<510){
rd=0.0
gr=1.0
bl=-(wv-510。)/(510-490。)}
如果(wv>=510&&wv<580){
rd=(wv-510.)/(580-510.)
gr=1.0
bl=0.0}
如果(wv>=580&&wv<645){
rd=1.0
gr=-(wv-645.)/(645-580.)
bl=0.0}
如果(wv>=645&&wv 730){
rd=-(730-780.)/(780-645.)
gr=0.0
bl=0.0}
rgb=int(255*rd)*2^16+int(255*gr)*2^8+int(255*bl)
printf(“%7.4f%f%f%f%f%3d%3d%3d%10d\n”,$1/10000,41,rd,gr,bl,rd*255,gr*255,bl*255,rgb)
}'>rgb.tmp

gnuplot这是一个有点手动的解决方案,但是一堆垂直线怎么样。这是一个开始。此线宽适用于1200900的打印窗口

set arrow 1 from 0.4,0 to 0.4, 50 nohead lc rgb '#8B008B#' lw 3.5
set arrow 2 from 0.405,0 to 0.405, 50 nohead lc rgb '#7000aF#' lw 3.5
set arrow 3 from 0.41,0 to 0.41, 50 nohead lc rgb '#4800FF#' lw 3.5
set arrow 4 from 0.415,0 to 0.415, 50 nohead lc rgb '#3000FF#' lw 3.5
set arrow 5 from 0.42,0 to 0.42, 50 nohead lc rgb '#1800FF#' lw 3.5
set arrow 6 from 0.425,0 to 0.425, 50 nohead lc rgb '#0000FF#' lw 3.5
set arrow 7 from 0.43,0 to 0.43, 50 nohead lc rgb '#0018FF#' lw 3.5
set arrow 8 from 0.435,0 to 0.435, 50 nohead lc rgb '#0030FF#' lw 3.5
set arrow 9 from 0.44,0 to 0.44, 50 nohead lc rgb '#0048FF#' lw 3.5
set arrow 10 from 0.445,0 to 0.445, 50 nohead lc rgb '#0060FF#' lw 3.5
set arrow 11 from 0.45,0 to 0.45, 50 nohead lc rgb '#0078FF#' lw 3.5
set arrow 12 from 0.455,0 to 0.455, 50 nohead lc rgb '#0088FF#' lw 3.5
set arrow 13 from 0.46,0 to 0.46, 50 nohead lc rgb '#0090FF#' lw 3.5
set arrow 14 from 0.465,0 to 0.465, 50 nohead lc rgb '#00a0FF#' lw 3.5
set arrow 15 from 0.47,0 to 0.47, 50 nohead lc rgb '#00b8FF#' lw 3.5
set arrow 16 from 0.475,0 to 0.475, 50 nohead lc rgb '#00d0FF#' lw 3.5
set arrow 17 from 0.48,0 to 0.48, 50 nohead lc rgb '#00fe8FF#' lw 3.5
set arrow 18 from 0.485,0 to 0.485, 50 nohead lc rgb '#00FFFF#' lw 3.5
set arrow 19 from 0.49,0 to 0.49, 50 nohead lc rgb '#7CFFa0#' lw 3.5
set arrow 20 from 0.495,0 to 0.495, 50 nohead lc rgb '#7CFF80#' lw 3.5
set arrow 21 from 0.5,0 to 0.5, 50 nohead lc rgb '#7CFF60#' lw 3.5
set arrow 22 from 0.505,0 to 0.505, 50 nohead lc rgb '#7CFF40#' lw 3.5
set arrow 23 from 0.51,0 to 0.51, 50 nohead lc rgb '#7CFF20#' lw 3.5
set arrow 24 from 0.515,0 to 0.515, 50 nohead lc rgb '#7CFF10#' lw 3.5
set arrow 25 from 0.52,0 to 0.52, 50 nohead lc rgb '#7CFF00#' lw 3.5
set arrow 26 from 0.525,0 to 0.525, 50 nohead lc rgb '#80FF00#' lw 3.5
set arrow 27 from 0.53,0 to 0.53, 50 nohead lc rgb '#88FF00#' lw 3.5
set arrow 28 from 0.535,0 to 0.535, 50 nohead lc rgb '#90FF00#' lw 3.5
set arrow 29 from 0.54,0 to 0.54, 50 nohead lc rgb '#98FF00#' lw 3.5
set arrow 30 from 0.545,0 to 0.545, 50 nohead lc rgb '#a0FF00#' lw 3.5
set arrow 31 from 0.55,0 to 0.55, 50 nohead lc rgb '#a8FF00#' lw 3.5
set arrow 32 from 0.555,0 to 0.555, 50 nohead lc rgb '#b0FF00#' lw 3.5
set arrow 33 from 0.56,0 to 0.56, 50 nohead lc rgb '#c0FF00#' lw 3.5
set arrow 34 from 0.565,0 to 0.565, 50 nohead lc rgb '#d0FF00#' lw 3.5
set arrow 35 from 0.57,0 to 0.57, 50 nohead lc rgb '#e0FF00#' lw 3.5
set arrow 36 from 0.575,0 to 0.575, 50 nohead lc rgb '#f0FF00#' lw 3.5
set arrow 37 from 0.58,0 to 0.58, 50 nohead lc rgb '#FFFF00#' lw 3.5
set arrow 38 from 0.585,0 to 0.585, 50 nohead lc rgb '#FFcF00#' lw 3.5
set arrow 39 from 0.59,0 to 0.59, 50 nohead lc rgb '#FFA500#' lw 3.5
set arrow 40 from 0.595,0 to 0.595, 50 nohead lc rgb '#FFA500#' lw 3.5
set arrow 41 from 0.6,0 to 0.6, 50 nohead lc rgb '#FF9800#' lw 3.5
set arrow 42 from 0.605,0 to 0.605, 50 nohead lc rgb '#FF8000#' lw 3.5
set arrow 43 from 0.61,0 to 0.61, 50 nohead lc rgb '#FF7000#' lw 3.5
set arrow 44 from 0.615,0 to 0.615, 50 nohead lc rgb '#FF6000#' lw 3.5
set arrow 45 from 0.62,0 to 0.62, 50 nohead lc rgb '#FF5000#' lw 3.5
set arrow 46 from 0.625,0 to 0.625, 50 nohead lc rgb '#FF4000#' lw 3.5
set arrow 47 from 0.63,0 to 0.63, 50 nohead lc rgb '#FF3800#' lw 3.5
set arrow 48 from 0.635,0 to 0.635, 50 nohead lc rgb '#FF3000#' lw 3.5
set arrow 49 from 0.64,0 to 0.64, 50 nohead lc rgb '#FF2000#' lw 3.5
set arrow 50 from 0.645,0 to 0.645, 50 nohead lc rgb '#FF1000#' lw 3.5
set arrow 51 from 0.65,0 to 0.65, 50 nohead lc rgb '#FF0000#' lw 3.5
set arrow 52 from 0.655,0 to 0.655, 50 nohead lc rgb '#FF0000#' lw 3.5
set arrow 53 from 0.66,0 to 0.66, 50 nohead lc rgb '#f00000#' lw 3.5
set arrow 54 from 0.665,0 to 0.665, 50 nohead lc rgb '#e00000#' lw 3.5
set arrow 55 from 0.67,0 to 0.67, 50 nohead lc rgb '#d00000#' lw 3.5
set arrow 56 from 0.675,0 to 0.675, 50 nohead lc rgb '#c00000#' lw 3.5
set arrow 57 from 0.68,0 to 0.68, 50 nohead lc rgb '#b00000#' lw 3.5
set arrow 58 from 0.685,0 to 0.685, 50 nohead lc rgb '#a00000#' lw 3.5
set arrow 59 from 0.69,0 to 0.69, 50 nohead lc rgb '#900000#' lw 3.5
set arrow 60 from 0.695,0 to 0.695, 50 nohead lc rgb '#800000#' lw 3.5
set arrow 61 from 0.7,0 to 0.7, 50 nohead lc rgb '#700000#' lw 3.5
set arrow 1 from 0.4,0 to 0.4, 50 nohead lc rgb '#8B008B#' lw 3.5
set arrow 2 from 0.405,0 to 0.405, 50 nohead lc rgb '#7000aF#' lw 3.5
set arrow 3 from 0.41,0 to 0.41, 50 nohead lc rgb '#4800FF#' lw 3.5
set arrow 4 from 0.415,0 to 0.415, 50 nohead lc rgb '#3000FF#' lw 3.5
set arrow 5 from 0.42,0 to 0.42, 50 nohead lc rgb '#1800FF#' lw 3.5
set arrow 6 from 0.425,0 to 0.425, 50 nohead lc rgb '#0000FF#' lw 3.5
set arrow 7 from 0.43,0 to 0.43, 50 nohead lc rgb '#0018FF#' lw 3.5
set arrow 8 from 0.435,0 to 0.435, 50 nohead lc rgb '#0030FF#' lw 3.5
set arrow 9 from 0.44,0 to 0.44, 50 nohead lc rgb '#0048FF#' lw 3.5
set arrow 10 from 0.445,0 to 0.445, 50 nohead lc rgb '#0060FF#' lw 3.5
set arrow 11 from 0.45,0 to 0.45, 50 nohead lc rgb '#0078FF#' lw 3.5
set arrow 12 from 0.455,0 to 0.455, 50 nohead lc rgb '#0088FF#' lw 3.5
set arrow 13 from 0.46,0 to 0.46, 50 nohead lc rgb '#0090FF#' lw 3.5
set arrow 14 from 0.465,0 to 0.465, 50 nohead lc rgb '#00a0FF#' lw 3.5
set arrow 15 from 0.47,0 to 0.47, 50 nohead lc rgb '#00b8FF#' lw 3.5
set arrow 16 from 0.475,0 to 0.475, 50 nohead lc rgb '#00d0FF#' lw 3.5
set arrow 17 from 0.48,0 to 0.48, 50 nohead lc rgb '#00fe8FF#' lw 3.5
set arrow 18 from 0.485,0 to 0.485, 50 nohead lc rgb '#00FFFF#' lw 3.5
set arrow 19 from 0.49,0 to 0.49, 50 nohead lc rgb '#7CFFa0#' lw 3.5
set arrow 20 from 0.495,0 to 0.495, 50 nohead lc rgb '#7CFF80#' lw 3.5
set arrow 21 from 0.5,0 to 0.5, 50 nohead lc rgb '#7CFF60#' lw 3.5
set arrow 22 from 0.505,0 to 0.505, 50 nohead lc rgb '#7CFF40#' lw 3.5
set arrow 23 from 0.51,0 to 0.51, 50 nohead lc rgb '#7CFF20#' lw 3.5
set arrow 24 from 0.515,0 to 0.515, 50 nohead lc rgb '#7CFF10#' lw 3.5
set arrow 25 from 0.52,0 to 0.52, 50 nohead lc rgb '#7CFF00#' lw 3.5
set arrow 26 from 0.525,0 to 0.525, 50 nohead lc rgb '#80FF00#' lw 3.5
set arrow 27 from 0.53,0 to 0.53, 50 nohead lc rgb '#88FF00#' lw 3.5
set arrow 28 from 0.535,0 to 0.535, 50 nohead lc rgb '#90FF00#' lw 3.5
set arrow 29 from 0.54,0 to 0.54, 50 nohead lc rgb '#98FF00#' lw 3.5
set arrow 30 from 0.545,0 to 0.545, 50 nohead lc rgb '#a0FF00#' lw 3.5
set arrow 31 from 0.55,0 to 0.55, 50 nohead lc rgb '#a8FF00#' lw 3.5
set arrow 32 from 0.555,0 to 0.555, 50 nohead lc rgb '#b0FF00#' lw 3.5
set arrow 33 from 0.56,0 to 0.56, 50 nohead lc rgb '#c0FF00#' lw 3.5
set arrow 34 from 0.565,0 to 0.565, 50 nohead lc rgb '#d0FF00#' lw 3.5
set arrow 35 from 0.57,0 to 0.57, 50 nohead lc rgb '#e0FF00#' lw 3.5
set arrow 36 from 0.575,0 to 0.575, 50 nohead lc rgb '#f0FF00#' lw 3.5
set arrow 37 from 0.58,0 to 0.58, 50 nohead lc rgb '#FFFF00#' lw 3.5
set arrow 38 from 0.585,0 to 0.585, 50 nohead lc rgb '#FFcF00#' lw 3.5
set arrow 39 from 0.59,0 to 0.59, 50 nohead lc rgb '#FFA500#' lw 3.5
set arrow 40 from 0.595,0 to 0.595, 50 nohead lc rgb '#FFA500#' lw 3.5
set arrow 41 from 0.6,0 to 0.6, 50 nohead lc rgb '#FF9800#' lw 3.5
set arrow 42 from 0.605,0 to 0.605, 50 nohead lc rgb '#FF8000#' lw 3.5
set arrow 43 from 0.61,0 to 0.61, 50 nohead lc rgb '#FF7000#' lw 3.5
set arrow 44 from 0.615,0 to 0.615, 50 nohead lc rgb '#FF6000#' lw 3.5
set arrow 45 from 0.62,0 to 0.62, 50 nohead lc rgb '#FF5000#' lw 3.5
set arrow 46 from 0.625,0 to 0.625, 50 nohead lc rgb '#FF4000#' lw 3.5
set arrow 47 from 0.63,0 to 0.63, 50 nohead lc rgb '#FF3800#' lw 3.5
set arrow 48 from 0.635,0 to 0.635, 50 nohead lc rgb '#FF3000#' lw 3.5
set arrow 49 from 0.64,0 to 0.64, 50 nohead lc rgb '#FF2000#' lw 3.5
set arrow 50 from 0.645,0 to 0.645, 50 nohead lc rgb '#FF1000#' lw 3.5
set arrow 51 from 0.65,0 to 0.65, 50 nohead lc rgb '#FF0000#' lw 3.5
set arrow 52 from 0.655,0 to 0.655, 50 nohead lc rgb '#FF0000#' lw 3.5
set arrow 53 from 0.66,0 to 0.66, 50 nohead lc rgb '#f00000#' lw 3.5
set arrow 54 from 0.665,0 to 0.665, 50 nohead lc rgb '#e00000#' lw 3.5
set arrow 55 from 0.67,0 to 0.67, 50 nohead lc rgb '#d00000#' lw 3.5
set arrow 56 from 0.675,0 to 0.675, 50 nohead lc rgb '#c00000#' lw 3.5
set arrow 57 from 0.68,0 to 0.68, 50 nohead lc rgb '#b00000#' lw 3.5
set arrow 58 from 0.685,0 to 0.685, 50 nohead lc rgb '#a00000#' lw 3.5
set arrow 59 from 0.69,0 to 0.69, 50 nohead lc rgb '#900000#' lw 3.5
set arrow 60 from 0.695,0 to 0.695, 50 nohead lc rgb '#800000#' lw 3.5
set arrow 61 from 0.7,0 to 0.7, 50 nohead lc rgb '#700000#' lw 3.5