我基本上想要做的基本上是与该问题的解决方案Gnuplot 5.2 splot相同:在一个plot调用中有多个pm3d调色板,但它与pm3d一起使用。如果您阅读了对该答案的评论,则回答者说,如果他使用pm3d,则该解决方案将不起作用。另外,是否有可能以更简单的方式定义调色板,例如set palette defined ()
?
gnuplot的开发分支支持多个命名调色板。但是,此处显示的方法也适用于早期版本的gnuplot。它使用填充样式来提供颜色(而不是pm3d调色板),并显示如何定义填充颜色以使其模仿set palette defined()
。该演示仅构建一个映射,但是您可以定义多个映射,每个映射都有其自己的颜色数组和映射函数以使用它们。
该演示摘自开发分支中命名调色板的完整演示。如果您有兴趣,可以在这里找到完整的演示:5.5版名为palette demo
#
# Demonstrate construction and use of a separate palette
# Ethan A Merritt - May 2020
#
# Method 1:
# The first method works also in 5.2 but requires "lc rgb variable"
# rather than the more natural "fillcolor rgb variable".
# "set pm3d interpolate" breaks the color mapping of this method
#
# This creates a palette equivalent to
# set palette defined (0 "dark-blue", 1 "white")
#
array blues[256]
do for [i=1:256] {
blues[i] = int( (0x7f + (i-1)/(255.) * 0xffff80) );
}
#
# This is the equivalent of
# set cbrange [-1:1]
blues_min = -1
blues_max = 1
#
# This function maps z onto a palette color
#
blues(z) = (z <= blues_min) ? blues[1] \
: (z >= blues_max) ? blues[256] \
: blues[ floor(255. * (z-blues_min)/(blues_max-blues_min)) + 1]
foo(x,y) = sin(x*y)
set samples 41
set isosamples 41
unset colorbox
set cbrange [-1:1]
set xrange [0:5]; set urange [0:5]
set yrange [0:5]; set vrange [0:5]
set title "Use hand-constructed 'blues' palette via rgb variable"
splot '++' using 1:2:(foo($1,$2)):(blues(foo($1,$2))) with pm3d fillcolor rgb variable \
title "pm3d using 1:2:3:4 with pm3d fillcolor rgb variable"
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句