替换Gnuplot热图(pm3d图)中的颜色 [英] Replacing Colors in Gnuplot Heat Maps (pm3d map)

查看:81
本文介绍了替换Gnuplot热图(pm3d图)中的颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有几个文件想要以二维方式绘制而无需插值(即热图).数据分为三列(不是矩阵):

I have several files that I would like to plot in 2D without interpolation (i.e. a heat map). The data is in three columns (not as a matrix):

#Example data
0 0 1
0 1 -1
0 2 10

1 0 -2
1 1 -0.1
1 2 20

我正在使用以下命令(版本4.4):

I am using the following commands (Version 4.4):

set pm3d map
set palette rgbformulae 22,13,-31
plot "file" us 1:2:($3>=0?0:$3) notitle w image

产生以下图像:

但是,我想要的是:

  1. 确保所有(第3列)小于零的值都将遵循调色板
  2. 确保所有(第3列)大于或等于零的值均为白色
  3. 颜色栏不包含白色

我希望图像看起来像这样:

I want the image to look like this:

请注意,这仅是示例.在我的真实数据中,大于或等于零的值分散在整个数据中.我整个上午一直在玩耍,但尚未提出解决方案.任何建议将不胜感激.

Note, that this is only an example. In my real data, the values that are greater than or equal to zero are dispersed throughout the data. I've been playing around with this all morning but have yet to come up with a solution. Any suggestions would be greatly appreciated.

推荐答案

这是通过将这些值设置为NaN来实现的:

This is achieved by setting those values to NaN:

set view map
set palette rgbformulae 22,13,-31
plot "file" us 1:2:($3>=0?NaN:$3) notitle w image

此方法仅适用于某些终端设备(请参见在保留调色板的情况下使用Gnuplot透明转换矩阵中特定值的方法?

This method works only with some terminals (see the discussion at Transparency for specific values in matrix using Gnuplot while preserving the palette?): It works at least with wxt, pdfcairo, pngcairo and png. It does not work with at least x11 and postscript.

4.6.3的结果是:

The result with 4.6.3 is:

这篇关于替换Gnuplot热图(pm3d图)中的颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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