# Plot with Color Data as Third Coordinate of Ordered Pairs

Suppose I have a data set

data={{0,0,-1},{0,1,-0.5},{1,1,0},{2,1,0.5},{2,2,1}};


where the first two coordinates are x and y values, and the third is input for the color gradient function

crgrad[x_] := Blend[{{-1, Blue},{0, Black}, {1, Red}}, x];


What is the correct way to plot the data points and have each point be its corresponding color? I have already tried

dataPlt = Graphics[{Point[{#1, #2}], ColorFunction -> (crgrad[#3])} & @@@ data];


I also want to incorporate

ColorFunctionScaling -> False


Thanks!

• Graphics[{crgrad[#3], Point[{#1, #2}]} & @@@ data]? – kglr Mar 29 '16 at 5:10
• Thanks for the reply, but that also does not work. – S2167 Mar 29 '16 at 6:04

If you do not have to use ColorFunction, you can use

Graphics[{crgrad[#3], PointSize[.05], Point[{#1, #2}]} & @@@ data]


or

Graphics[{PointSize[.05], Point[{#1, #2}, VertexColors -> crgrad[#3]]} & @@@ data]


or

ListPlot[Style[{#, #2}, crgrad[#3], PointSize[.05]] & @@@ data,
Axes -> False, PlotRangePadding -> .2, AspectRatio -> 1]


• For some reason I could not get the method to work after reading your comment, but it now works brilliantly. Thank you. – S2167 Mar 29 '16 at 7:07
• @S2167, thank you for the accept. – kglr Mar 29 '16 at 8:31