2

I have a data file containing three columns. I'd like to plot (1st, 2nd) and use the 3rd to produce a colour-map. That is, each point in the plain takes a colour that depends on the value in the third column.

Using Gnuplot, I can easily do that:

gnuplot> set palette rgbformulae 33,13,10
plot "output.dat" using 1:2:3  with points palette

For a set of data I get something like this: enter image description here

Now, is there a straightforward way of doing this in Mathematica?

4

1 に答える 1

2

You can construct it from graphics primitives:

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}]

Mathematica graphics

Regarding the colour bar:

The built-in colour bar functionality is not excellent. You can read abut it here. There's an alternative implementation here. My question here may also be useful.

于 2012-05-05T11:39:36.130 に答える