我有一个包含三列的数据文件。我想绘制(第一个,第二个)并使用第三个来生成颜色图。也就是说,平原中的每个点所采用的颜色取决于第三列中的值。
使用 Gnuplot,我可以轻松做到这一点:
gnuplot> set palette rgbformulae 33,13,10
plot "output.dat" using 1:2:3 with points palette
对于一组数据,我得到如下结果:
现在,在 Mathematica 中是否有一种简单的方法可以做到这一点?
最佳答案
您可以从图形基元构建它:
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可能也有用。
关于wolfram-mathematica - Gnuplot 和 Mathematica 中的颜色图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10457452/