我想问一下是否有人知道如何管理gnuplot中的调色板指示器,我希望它适合我的颜色(12)而不是自动添加
我的代码是
set palette model HSV
set palette rgb 3,2,2
set palette maxcolors 12
set view map
set size square
set key off
set title "Neural network output (fitted curve)"
set xlabel "x"
set ylabel "y"
set zlabel "z"
set xrange [ -7.6625930750000002 : 27.166801390000000 ]
set yrange [ 0.35422432799999998 : 30.163194489999999 ]
set zrange [ -55.934824620000001 : 2.4059901000000002E-002 ]
set grid
set terminal png size 1200,900
set output "output/fitted_curve.png "
splot "output/plot_data_pl.txt " with points palette pt 7 ps 1
答案 0 :(得分:1)
为了获得最大的灵活性,您应该定义自己的palette
这是我曾经做过的,以获得7种不同颜色的情节。因此,我还可以定义哪种颜色代表给定的值范围。
set palette defined (0 "black",\
0.5 "black",\
0.5 "red",\
1.5 "red",\
1.5 "orange-red",\
2.5 "orange-red",\
2.5 "orange",\
3.5 "orange",\
3.5 "yellow",\
4.5 "yellow",\
4.5 "light-green",\
5.5 "light-green",\
5.5 "green",\
6.5 "green")
因此,您实际上必须定义从/想要颜色跨越的值 当然,您可以为您的颜色使用rgb定义。 gnuplot定义的颜色列表为here。
为了完整起见,这是我使用的完整代码:
set view map
set pm3d
set term pngcairo crop font 'lmroman10,32' size 1152,864
set border lw 2
set palette defined (0 "black", 0.5 "black", 0.5001 "red", 1.5 "red", 1.5001 "orange-red", 2.5 "orange-red", 2.5001 "orange", 3.5 "orange", 3.5001 "yellow", 4.5 "yellow", 4.5001 "light-green", 5.5 "light-green", 5.5001 "green", 6.5 "green")
set xlab 'time step ' offset 0,1
set xtics 2500 offset 0,0.65
set ylab 'position [cell]' offset +.5,0
set cblab 'velocity [cells/(time step)]' offset -.8,0
set cbtics offset -1.2,0
set xrange[100000:110000]
set yrange[0:10000]
set cbrange[0:6.5]
set style line 1 lt 1 lc rgb "blue" lw .85 pt 6 ps .6
splot '6.csv' u (($1)):($2):($3) w p palette t '', 'data.csv' u (($1)):($2):($3*0) w l ls 1 t '', 'data2.csv' u (($1)):($2):($3*0) w l ls 1 t ''