Gnuplot 根据矩阵数据在极坐标中绘制 2D 热图

问题描述 投票:0回答:2

过去几天我尝试将矩阵绘制成极坐标二维热图。该矩阵由 80x720 数据点组成。更详细地说明整个事情。它是来自极坐标(极图)的 XRD 数据。列是样品在 0° 到 360° 之间以 0.5° 为步长旋转的角度(我们称之为 phi),行是样品在 35° 到 75° 之间以 0.5° 为步长倾斜的另一个角度(我们称其为 psi)。矩阵中特定位置的值是探测器在这些角度处的强度。我想最终得到一个极坐标图,其中半径为 psi,角度为 phi,z 或更精确的颜色代表强度。

我已经发现this很好地讨论了问题,但无法将其应用于我的问题。我设法使用 pm3d 地图用 splot -file- matrix u ($2/2):($1/2):3 绘制了整个事情,但这显然不是极性的。

这里有人知道如何以极坐标形式绘制矩阵吗? 非常感谢!任何关于采取什么方向的建议将非常感激

(我还有 80 个该测量的单独数据文件,其中包含 psi 角度(0°-360°)和相应的强度,但到目前为止对我没有多大帮助)。

干杯 弗洛

gnuplot heatmap polar-coordinates
2个回答
1
投票

请参阅

help set mapping
了解
set mapping cylindrical
产生的坐标变换的说明。如果我理解正确的话,你也许可以使用类似的东西:

set mapping cylindrical
set view equal xy
set view map
set angle degrees
splot 'data' matrix using 2:1:3 with pm3d

如果文件中的数值还不是角度值,您可能需要转换函数,例如从样品编号到对应的角度:

theta(col) = col * 0.5
phi(row) = some_offset + row * some_scale_factor
splot 'data' matrix using (theta($2)) : (phi($1)) : 3 with pm3d

如果结果很糟糕,请附上实际的数据文件,以便我们可以找出可能需要哪些额外的数据规范。下面我展示了一个使用线性梯度形式的人工数据的示例。 urange 和 vrange 仅与定义人工数据的采样网格相关

'++'
;您不需要它们来获取文件中的数据。

set cblabel "Intensity"
unset border
set tics nomirror
set xtics axis; set ytics axis
set xzeroaxis; set yzeroaxis
set vrange [25:290]    # This is the column number (theta in 0.5° steps)
set urange [10:20]     # This is the row number (phi)

splot '++' using (theta($2)) : 1 : ($1) with pm3d notitle


0
投票

从未来重温

Gnuplot 版本 6 通过新命令

set polar grid
提供极地热图绘制样式。类似于由
set dgrid3d
控制的笛卡尔坐标模式。

#
# Polar mode heat map in gnuplot version 6
# artificially generated data points
#

set cblabel "Intensity"
unset key
set palette cubehelix negative

set isotropic   # make the circle look circular

set polar
set angle degrees


# Define a grid with 0.5° increments on theta; 1 unit increments on r.
# Contributions from nearby grid points will be summed.
set polar grid 720, 50  qnorm 1 kdensity scale 0.001

set rrange [0:50]

set tics front
unset xtics
unset ytics
set rtics 10.0
set ttics 0,30,330 format "%h°"
set border 0 polar
set grid front polar

# The data source '++' will sample the two variables u and v.
# We use u to generate 200 theta values from 25° to 290°
# We use v to generate 11 r values 10,11,12,...20  (explicit sampling interval)
# The point at (theta,r) is assigned randomized value f(r) just to have some variety.

f(r) = rand(0)

set samples 200
plot sample [u=25:290][v=10:20:1] '++' using 1:2:(f($2)) with surface

© www.soinside.com 2019 - 2024. All rights reserved.