本文介绍了减少绘图中点之间的距离的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个gnuplot脚本

reset
set palette model RGB defined (0 "gray", 0.1 "white", 0.33 "yellow", 0.66 "orange", 1 "red")
set xlabel "x"
set ylabel "y"
set view map
set border 0
unset xtics
unset ytics
splot file_name u 1:2:5:xtic(3):ytic(4) w points ps 5 pt 5 palette

这是结果:

如何删除点之间的距离,以得到一组相邻的正方形?我想为我的网格文件中的每个点绘制一个带有正方形的热图.

编辑

按照@andyras答案绘制网格"热图的正确方法是:

set pm3d map
plot file_name u 1:2:5:xtic(3):ytic(4) with image

哪个给出了这张图片:

gnuplot提供了第三种基于3d曲面而不是网格单元的连接点绘制热图的方法.也就是说,第1,2列的x,y坐标用作表面网格的角或连接点,并且每个区域中使用的颜色是RGB/HSV值的平均值4个定义角:

set pm3d map
splot file_name u 1:2:5:xtic(3):ytic(4)
解决方案

我通常会选择选项

set pm3d map
plot file_name u 1:2:5:xtic(3):ytic(4) with image

用于栅格数据(如果使用矢量格式,它将生成较小的文件).我怀疑您的问题可能与您为绘图指定点样式和大小有关.因此,您可以尝试设置pm3d map选项并在没有点指定或plot ... with image的情况下使用splot.

I have this gnuplot script

reset
set palette model RGB defined (0 "gray", 0.1 "white", 0.33 "yellow", 0.66 "orange", 1 "red")
set xlabel "x"
set ylabel "y"
set view map
set border 0
unset xtics
unset ytics
splot file_name u 1:2:5:xtic(3):ytic(4) w points ps 5 pt 5 palette

And this is the result:

How can I remove the distance between the points so that I end up with a set of adjacent squares? I want to plot a heatmap with a square for each point in my grid file.

EDIT

The correct way to plot a "grid" heatmap as per @andyras answer is:

set pm3d map
plot file_name u 1:2:5:xtic(3):ytic(4) with image

Which gives this image:

gnuplot offers a third way to plot a heatmap based on connecting points of a 3d surface, rather than grid cells. That is, the x,y coordinates at columns 1,2 are used as corners, or connecting points, of a surface mesh and the colors used in each region are the average of the RGB/HSV values for the 4 defining corners:

set pm3d map
splot file_name u 1:2:5:xtic(3):ytic(4)
解决方案

I usually go with the options

set pm3d map
plot file_name u 1:2:5:xtic(3):ytic(4) with image

for gridded data (it makes a smaller file if you use vector formats). I suspect your problem may be to do with the fact that you specify a point style and size for your splot. So, you could try setting the pm3d map option and using splot without the point specification, or plot ... with image.

这篇关于减少绘图中点之间的距离的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-29 03:59