我有一个包含三列的数据文件。我想绘制(第1个,第2个)并使用第3个来生成颜色贴图。也就是说,平面中的每个点都采用取决于第三列中的值的颜色。
使用Gnuplot,我可以很容易地做到这一点:
gnuplot> set palette rgbformulae 33,13,10
plot "output.dat" using 1:2:3 with points palette
对于一组数据,我得到这样的东西:
现在,在Mathematica中有这么简单的方法吗?
答案 0 :(得分:2)
您可以从图形基元构建它:
data = RandomReal[1, {20, 3}];
(* rescale 3rd column to be between 0 and 1, if needed *)
data[[All, 3]] = Rescale[data[[All, 3]]];
Graphics[{PointSize[.03], {ColorData["ThermometerColors"][#3], Point[{#1, #2}]} & @@@ data}]
关于颜色条:
内置彩条功能并不出色。你可以阅读它here。还有另一种实现here。 My question here也可能有用。