自定义Gnuplot中的颜色范围 [英] Customize color ranges in Gnuplot

查看:200
本文介绍了自定义Gnuplot中的颜色范围的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的轮廓图运行得很好,并且为不同的值生成了相等数量的颜色.

I have a contour plot running just fine and it is generating an equal amount of color for different values.

我想要的是在右侧生成标签,以使每个块具有正确的颜色.

What I want is to generate the label on the right side to have a right color for each block.

当前结果:

我想要的是在每个块上都具有此值:

What I want is to have this value on each block:

---- 300

---- 100

---- 70

---- 30

---- 10

---- 1

---- 0

当我添加此代码时:

set cbtics ('300' 300, '100' 100, '30' 30, '10' 10, '1' 1, '0.5' 0.5, '0.1' 0.1, '0.01' 0.01, '0' 0);
set palette defined (0.1 "#4CAF4F",0.3 "#65B443",0.5 "#7FBA38",0.7 "#98BF2D",0.9 "#B2C521",1.0 "#CBCA16",2 "#E5D00B",3 "#FFD600",4 "#FFC400",5 "#FFB300",6 "#FFA100",7 "#FF9000",8 "#FF7E00",10 "#FF6D00",30 "#F85A00",50 "#F14800",70 "#EA3600",90 "#E32400",100 "#DC1200",300 "#D50000")

结果为不均匀:

我希望滴答声是均匀的,但无法做到.

I want the ticks to be even but could not make it.

推荐答案

我建议您将输出从0到300的比例重新缩放到一个值,该值在颜色栏上手动定义的标签之间线性变化:

I would recommend that you rescale your output from the scale 0 to 300 to a scale in which the values vary linearly between the manually defined labels on the color bar:

rescale(x) = ( x >= 0. && x < 1. ? x : \
               x >= 1. && x < 10. ? 1.+(x-1.)/(10.-1.) : \
               x >= 10. && x < 30. ? 2.+(x-10.)/(30.-10.) : \
               x >= 30. && x < 70. ? 3.+(x-30.)/(70.-30.) : \
               x >= 70. && x < 100. ? 4.+(x-70.)/(100.-70.) : \
               x >= 100. && x < 300. ? 5.+(x-100.)/(300.-100.) : \
               1/0)
set cbrange [0:6]
set cbtics ("0" 0, "1" 1, "10" 2, "30" 3, "70" 4, "100" 5, "300" 6)
set pm3d
splot rescale(x**2+y**2)

如果要将颜色限制为每块一种,请添加以下行:

If you want to limit the colors to one per block, add the following line:

set palette maxcolors 6

最后,请注意,如果您有地图,则标签就足够了.如果您有3D图,则可能还需要重新标记z轴:

Finally, note that if you have a map the labeling is sufficient as is. If you have a 3D plot, you might want to also relabel the z axis:

set ztics ("0" 0, "1" 1, "10" 2, "30" 3, "70" 4, "100" 5, "300" 6)

这篇关于自定义Gnuplot中的颜色范围的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆