2
$\begingroup$

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.

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

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]

enter image description here

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

enter image description here


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

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

enter image description here

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

enter image description here

$\endgroup$
  • $\begingroup$ muchos gracias! $\endgroup$ – foster2 Oct 2 '14 at 11:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.