2

我正在尝试使用 datasetB 的等高线图创建 datasetA 的颜色图,这两者都是从文件中读取的。

以下成功创建了 datasetA 的颜色图:

plot 'valuesA.dat' matrix with image

我可以按照此处所述绘制轮廓。

我怎样才能结合这两个情节?

提前致谢!

4

2 回答 2

1

为了回答这个问题,这在gnuplot 技巧中得到了解决。

于 2013-11-25T23:29:35.607 回答
1

这是我最终为大小为 512x512 的数组(例如)所做的。假设我有一个A.dat用于颜色图和B.dat轮廓的数据文件。

  • 从包含轮廓数据的表中创建一个表B.dat并将其保存到一个临时文件temp.dat中。
  • 在单个命令中A.dat使用临时文件绘制颜色图并绘制轮廓线。temp.dat

这是我的代码(为了清楚起见,有些简化):

# Set initial state
reset
set term X11
set palette @MATLAB    # see http://www.gnuplotting.org/matlab-colorbar-with-gnuplot/

# Create a file for contour data
set contour base
set cntrparam levels 25
set isosample 250,250
unset surface
set table "temp.dat"
splot "B.dat" binary array=512x512 format='%double'
unset table


# Plot the final results
set title "Contours and Colormap"
set size square
unset key
set xtics ('0' 0, '0.5' 255, '1.0' 511)   # Change these according to your dimensions
set ytics ('0' 0, '0.5' 255, '1.0' 511)   # Change these according to your dimensions

set cbrange [0.0:1.0]
set xlabel "X (scaled by height)"
set ylabel "Z (scaled by height)"


set terminal png
set output "output.png"
plot "A.dat" binary array=512x512 format='%double' with image, "temp.dat" with lines lt -1

为了看看它是什么样子,我最终使用该代码的脚本版本来制作这部电影(和其他电影)以供我研究!

于 2014-08-15T04:44:30.657 回答