# How to put labels on a 3d plot

I'm close, but I'm stuck.

Here's my code so far:

data = Import["http://www.powerball.com/powerball/winnums-text.txt",
"Table", "HeaderLines" -> 1];

clipped = Take[data[[All, 2 ;; 7]]];

ListPointPlot3D[clipped];

balls = Take[clipped[[All, 1 ;; 6]]];

whiteballs = Take[balls, 10];

sorted = Map[Sort, whiteballs];

p = ListPlot3D[sorted, Mesh -> All, InterpolationOrder -> 0,
ColorFunction -> "TemperatureMap"]

labels = Graphics3D[Text[ToString@Round[#, 1], #, {0, 0}]] & /@
Take[sorted[[All, 1 ;; 3]]]

Show[{p, labels}]


I would like to have the ball numbers placed on top of each of the colored squares, but I'm out of ideas.

• They are here, see here for a smaller set of data. – Öskå Jul 18 '14 at 16:54

Update: BubbleChart with a custom ChartElementFunction:

bcdata = MapIndexed[Join[#2, {#1, 1}] &, whiteballs, {-1}];
(* transform data to a form acceptable for BarChart3D *)

ceF[ind_:3, sz_:36, c_:Black][{{xmin_, xmax_}, {ymin_, ymax_},{zmin_, zmax_}}, v_, m_] :=
Dynamic@Module[{vtc = {{0, 0}, {0, 1}, {1, 1}, {1, 0}}},
{EdgeForm[{Darker@CurrentValue["Color"], Thick}],
FaceForm[Texture[Framed[Style[ToString@(Floor /@ v[[ind]]), sz, Bold, c],
Background -> Lighter@CurrentValue["Color"]]]],
Polygon[{{xmin, ymin, (zmin + zmax)/2},
{xmin, ymax, (zmin + zmax)/2},
{xmax, ymax, (zmin + zmax)/2},
{xmax, ymin, (zmin + zmax)/2}}, VertexTextureCoordinates -> vtc]}]


Examples:

BubbleChart3D[bcdata, ChartElementFunction -> ceF[],
ColorFunction -> Function[{x, y, z, r}, ColorData["TemperatureMap"][z]],
BoxRatios -> 1, ImageSize -> 500]


BubbleChart3D[bcdata, ChartElementFunction -> ceF[;; 3, 24, Black],
ColorFunction -> Function[{x, y, z, r}, ColorData["TemperatureMap"][z]],
BoxRatios -> 1, ImageSize -> 500]


Original post: Post-processing the output of ListPointPlot3D using Texture:

lpp = ListPointPlot3D[whiteballs,
PlotStyle -> PointSize[.03], ColorFunction -> "TemperatureMap",
Lighting -> "Neutral", ImageSize -> 500, BoxRatios -> 1]


vtc = {{0, 0}, {0, 1}, {1, 1}, {1, 0}};
lpp /. Hue[___] :> Sequence[] /.
{sty : RGBColor[__], Point[x_, ___]} :>
({EdgeForm[{Darker@sty, Thick}],
FaceForm[Texture[Framed[Style[ToString@(Floor /@ x), 64, Bold],
Background -> Lighter@sty]]],
Polygon[x + # & /@ {{-.5, -.5, 0}, {-.5, .5, 0}, {.5, .5, 0}, {.5, -.5, 0}},
VertexTextureCoordinates -> vtc]})


• muchos gracias! – foster2 Oct 2 '14 at 11:47