Gnuplot颜色渐变

3

我需要在我的图表中创建多个垂直渐变 - 共四个,以便澄清方向(北,东,南,西)。

#set 0 to 45 degrees color
set obj 1 rectangle behind from screen 0.09,0.2 to screen 0.89,0.29
set palette model RGB defined ( 0 "white", 1 "red")  
set cbrange[0:1]
unset colorbox

我这里是否有什么遗漏?谢谢提前。

1个回答

2

你无法使用渐变填充矩形。调色板只影响绘制的函数或数据集。你可以使用imagepm3d绘图样式来完成这个任务。

例如:

set samples 100
set isosample 100,100
set xrange [0:1]
set yrange [0:1]
set palette defined (0 "white", 1 "red")
set autoscale cbfix
unset colorbox
unset key

set multiplot layout 2,2   
plot '++' using 1:2:1 with image
plot '++' using 1:2:2 with image
plot '++' using 1:2:(-$1) with image
plot '++' using 1:2:(-$2) with image
unset multiplot

使用pngcairo终端和版本4.6.5的输出如下:

enter image description here

现在您需要找到一种方法将其与您拥有的其他图形集成。


我正在使用X11终端 - 是否需要其他规格?使用上述代码时我无法看到任何颜色 - 猜测这与终端类型有关? - user3778424
目前我只能测试wxt和Windows终端,它们都可以工作。我今晚可以检查x11终端。你是怎么运行这段代码的?在代码之前加上“reset”或者启动一个新的交互会话,也许你周围有一些残留的设置。 - Christoph
好的 - 我在x11终端中看到了颜色,所以你的代码示例有效..谢谢 - 我只需要根据我的目的进行修改即可。 - user3778424
你能稍微解释一下吗?- 设置调色板定义(0“白色”,1“红色”) 设置自动缩放cbfix 取消颜色框 取消键; 绘制'++'使用1:2:(- $ 2)与图像 - user3778424
最后一行是什么意思?这部分:1:2:(-$2)?我知道它是将gnuplot指向文件-文件1,列2,那么最后的符号是什么意思? - user3778424
显示剩余2条评论

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接