Gnuplot,您可以使用两种不同的调色板进行崇拜吗? [英] Gnuplot, can you use two different palettes worship?
问题描述
我想要两个不同的渐变.这有可能吗 两种不同的调色板?是的,如何声明它们?
I want to have two different gradients. Is this possible with two different palettes? And yes, how to declare them?
推荐答案
我想问题是您没有设置固定的cbrange
. set paletted defined
语句中给出的数值是相对值.根据您先前的问题,将颜色缩放到[-1:1]
范围.在这种情况下,调色板定义中的相对值和绘图中的相对值是重合的.但是,如果只有正值或只有负值,则cbrange
实际上是[-1:0]
或[0:1]
.只需使用set cbrange [-1:1]
,它就可以工作.
I guess the problem is that you don't set a fixed cbrange
. The numerical values given in the set paletted defined
statement are relative values. According to your previous questions you scale the color to the range [-1:1]
. In that case, your relative values in the palette definition and those in the plots coincide. However, if you have only positive or only negative values, then you have effectively a cbrange
of [-1:0]
or [0:1]
. Just use a set cbrange [-1:1]
and it should work.
下面的最小示例显示了您第一个未设置cbrange的情况,然后在第二个图中使用固定的cbrange
进行了显示的结果:
The following minimal example shows your first what happens without setting a cbrange, and then in the second plot the result with a fixed cbrange
:
文件test.txt
包含值
1 5
2 3
3 2
gnuplot脚本为:
The gnuplot script is:
set boxwidth 0.8 relative
set palette defined (-1 "#D30000", 0 "#00F000", 0 "#FFF900", 1 "#FF0700")
set style data boxes
set style fill solid 1.0 noborder
unset key
unset colorbox
set multiplot layout 1,2
set title 'wrong colors'
plot for [i=51:1:-1] 'test.txt' using 1:($2*i/51.0):(i/51.0) lc palette
set title 'correct colors'
set cbrange[-1:1]
replot
unset multiplot
4.6.3的结果:
这篇关于Gnuplot,您可以使用两种不同的调色板进行崇拜吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!