gpt4 book ai didi

gnuplot - 在 Gnuplot 中使用调色板进行绘图时,将低于某个截止点的点的颜色设置为灰色

转载 作者:行者123 更新时间:2023-12-04 00:14:51 25 4
gpt4 key购买 nike

抱歉,标题太长而且可能很糟糕。

我正在尝试在 gnuplot 中绘制一些数据,其中数据文件的格式为

x       y       z
1.0 1.5 0.1
1.3 1.8 0.7
2.1 3.7 1.1
3.1 4.3 1.5
3.7 4.7 1.8

我想绘制 y 与 x 的关系图,并且对于每个点,用该点的颜色指示 z 的值。目前我为此使用以下代码:

size = 0.5
type = 7
set term pngcairo
set output 'Foo.png'
set palette rgbformulae 22,13,-31
set cblabel "z"
unset key
set xlabel 'x'
set ylabel 'y'
set title 'y vs. x'
plot "Data.txt" u 1:2:3 w p pt type ps size palette

这可行,但我想进行以下更改:对于 z 值低于截止值(例如 1.0)的每个点,我希望将颜色设置为灰色,而不管 z 值如何。然后对于大于或等于截止值的 z 值,我希望根据 z 值从调色板中选择颜色。

因此,我希望颜色在截止值处不连续地从灰色变为蓝色(对于当前调色板)。这可以做到吗?如果可以,怎么做?

最佳答案

很难使用基于 rgbformulae 的调色板。使用定义的调色板相对容易。这是一个示例,它提供了一个接近您选择的调色板,在底部添加了一个深灰色。然后设置 cbrange 以使您的 z 截止值最小。所有低于 cbmin 的 z 值都将被分配端点值,在这种情况下为深灰色。

set xrange [0:1]; set yrange [0:pi]
set sample 100; set isosample 100
set palette defined (-0.01 "grey20", 0 "blue", 0.4 "green", 0.6 "yellow", 1.0 "red")

zmin = -0.6
set cbrange [zmin: *]
set xyplane at zmin
splot cos(x)*sin(y+y*(x*x)) with pm3d

enter image description here

关于gnuplot - 在 Gnuplot 中使用调色板进行绘图时,将低于某个截止点的点的颜色设置为灰色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64813524/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com