I have a dataset in which each element is a list of 3 numbers eg.
data={{0,0,0},{1,2,0.7},{3,4,2.3},{3,4,3.3}}
I'd like to make a 2 dimensional plot in this way: for each list in the dataset the first 2 elements specify the point coordinate in the 2D plot and the third element specifies a color taken from a color gradient (for example using ColorData[]
), so that close numbers have close colors; moreover, I'd like to show a bar legend with colors.
An example that solve the problem is this
mM=MinMax@data[[All,3]]
dataPoints=Tooltip[{Blend[{Red,Blue},Rescale[#[[3]],mM]],Point[{#[[1]],#[[2]]}]},#[[3]]]&/@data
Legended[Graphics[{AbsolutePointSize[10],dataPoints},Frame->True],BarLegend[{Blend[{Red,Blue},#]&,mM},ColorFunctionScaling->True]]
Apart that maybe there is a bug in the frontend, since it says that «ColorFunctionScaling
is not an option for BarLegend
», can I obtain such a plot without using the Graphics
command and related primitives?