1
$\begingroup$

I was able to plot following figure.

SeedRandom[123];
data = RandomInteger[{0, 10}, 36]~Partition~6;
T1 = Triangle[{{1, 0.85}, {7, 0.85}, {7, 0.55}}];
T2 = Triangle[{{0.85, 1}, {0.85, 7}, {0.55, 7}}];
range = Tuples[Range[1, 6], 2];
minMax = {0, 10};
vec = {{0, 0, 165}, {40, 50, 220}, {90, 120, 240}, {140, 180, 
247}, {195, 223, 240}, {230, 227, 230}, {240, 223, 195}, {247, 
180, 140}, {240, 120, 90}, {220, 50, 40}, {164, 0, 0}};
colAll = Blend[RGBColor @@@ (vec/255), Rescale[#, minMax]] &;
data1 = Partition[Thread[{range, Flatten@data}] // Flatten, 3];
Show[Graphics[{colAll[Last[#]], Rectangle[Most[#]]} & /@ data1,   ImageSize -> 300], Graphics[{EdgeForm[Thick], Black, T1, T2}]]

which produce the figure below

enter image description here

Can we add triangles edges of 3D box?

data2 = Flatten@
Riffle[Prepend[#, 1] & /@ Tuples[Range[1, 6], 2], data]~Partition~4;
Graphics3D[{colAll[Last[#]], Sphere[Most[#], 0.5]} & /@ data2,ImageSize -> 300]

This kind of result is desired

enter image description here

$\endgroup$
  • $\begingroup$ For the 3D figure above, triangles are added after pdf file created using adobe illustrator. So I will use it. I don't feel it produces the same effect. But it is not a big deal. Thanks for your try. $\endgroup$ – OkkesDulgerci Jun 24 '17 at 21:44
  • $\begingroup$ I will try to improve it if you want but please make clear what needs polishing. $\endgroup$ – Kuba Jun 24 '17 at 22:01
  • $\begingroup$ I am especially interested in putting triangles, don't worry about labels. if you make tips of triangles round like 2D case that would be better. $\endgroup$ – OkkesDulgerci Jun 25 '17 at 0:59
  • $\begingroup$ Please make the question self contained and clear, outline which features are are essential. If triangles are the main issue, there is not need for external data. Round? you mean EdgeForm@Thick like in you 2d case? Have you tried to add it and check? $\endgroup$ – Kuba Jun 25 '17 at 5:42
  • $\begingroup$ Yes, adding EdgeForm@Thick gives what I want. Thanks.. $\endgroup$ – OkkesDulgerci Jun 25 '17 at 14:19
3
$\begingroup$
data2 = Flatten@
    Riffle[Prepend[#, 1] & /@ Tuples[Range[1, 6], 2], data]~Partition~
   4;
Graphics3D[{
    { colAll[Last[#]], Sphere[Most[#], 0.5]} & /@ data2
  , { FaceForm@None, EdgeForm@Dashed
    , Cuboid[Scaled[{0, 0, 0} + .075], Scaled[{1, 1, 1} - .075]]
    }
  , Black
  , Polygon[
   Scaled /@ {{.05, .05, .05}, {.05, .05, .95}, {.05, 0, .95}}]
  , Polygon[
   Scaled /@ {{.05, .05, .05}, {.95, .05, .05}, {.95, 0, .05}}]
  , Polygon[
   Scaled /@ {{.95, .05, .05}, {.95, .95, .05}, {1, .95, .05}}]
  }
 , PlotRangePadding -> Scaled[.1]
 , ImageSize -> 300
 , Boxed -> False
 ]

enter image description here

$\endgroup$

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.