# 3D graphics with colourbar

I have lists with 4 data e.g.

{{0,0,0,-2000},{0,0,.5,-1800},{0,0,1,-1500},{0,.5,0,-2005},{0,.5,.5,-1795},
{0,.5,.1,-1508} ... {x,y,z,B}}


How can I plot B values as colours? I have to use Color bar (from about -2000 till 0). I tried it but it doesnt work.

Graphics3D[{Black, PointSize[.07],
Table[Point[points3D[[i]]], {i, 1, 5, 1}]}, Axes -> True,
ColorFunction -> (Function[list1[[i, 4]]]),
Hue[Rescale[x, {-0.5, 0.5}]], ColorFunctionScaling -> False,
ImageSize -> 800, BarLegend[{Hue, {0, -2000}}],
ColorFunctionScaling -> True]


Have you got any idea? I'd be grateful if someone help and thank you very much.

p4D = {{0, 0, 0, -2000}, {0, 0, .5, -1800}, {0, 0, 1, -1500}, {0, .5, 0, -2005},
{0, .5, .5, -1795}, {0, .5, .1, -1508}};


Rescale the fourth column to {-.5,.5}:

p4Db = Transpose[ MapAt[Rescale[#, Through@{Min, Max}@#, {-.5, .5}] &, Transpose[p4D], {-1}]];

Legended[Graphics3D[{Hue[#4], Sphere[{#, #2, #3}, .05]} & @@@ p4Db,
PlotRange -> {{-1.2, 1.2}, {-1.2, 1.2}, {-1.2, 1.2}}], BarLegend[{Hue, {-2000, 0}}]]


You can also use BubbleChart3D

Legended[BubbleChart3D[Style[{#, #2, #3, 1}, Hue[#4]] & @@@ p4Db,
BubbleSizes -> {0.05, .05}, BoxRatios -> 1],
BarLegend[{Hue, {-2000, 0}}]]


• Help of kguler don't give the good solution. I wrote it badly or the solution is bad. The answer of Bob Hanlon is OK. But at kguler I don't understand the steps of the command. Thanks. – user25315 Feb 11 '15 at 19:24
list = {{0, 0, 0, -2000}, {0, 0, .5, -1800}, {0, 0, 1, -1500}, {0, .5,
0, -2005}, {0, .5, .5, -1795}, {0, .5, .1, -1508}};

pts = Tooltip[Point[Most[#]], Last[#]] & /@ list;

minB = list[[All, 4]] // Min;
maxB = list[[All, 4]] // Max;

colors = ColorData["TemperatureMap"][
(minB - #)/(minB - maxB)] & /@
list[[All, 4]];

Row[{
Graphics3D[{
PointSize[Large],
`