1
$\begingroup$

I would like to plot points in 3D Space and show a number next to them.

How can I achieve this ?

Here is the list of coordinates / number :

(0 0 0)    //0
(35 0 0)   //1
(35 10 0)  //2
(0 10 0)   //3
(0 0 1)    //4
(35 0 1)   //5
(35 10 1)  //6
(0 10 1)   //7
(0 100 0)  //8
(35 100 0) //9
(0 100 1)  //10
(35 100 1) //11
(-20 0 0)  //12
(-20 0 1)  //13
(-20 10 0) //14
(-20 10 1) //15
(-20 100 0) //16
(-20 100 1) //17

In Mathematica Format:

corrd = {{0,0,0},{35,0,0},{35,10,0},{0,10,0},{0,0,1},{35,0,1},{35,10,1},{0,10,1},{0,100,0},{35,100,0},{0,100,1},{35,100,1},{-20,0,0},{-20,0,0},{-20,0,1},{-20,10,0},{-20,10,1},{-20,100,0},{-20,100,1}};

numb= Table[i,{i,0,17}];

I tryed ListPointPlot3D[corrd], but then I don't know how to show the number next to them ?

$\endgroup$
1
$\begingroup$

You can let the numbers be the markers, i.e., there isn't necessarily a need for points. You might also want to Style the numbers to make them easier to read.

corrd = DeleteDuplicates[{
    {0, 0, 0}, {35, 0, 0}, {35, 10, 0}, {0, 10, 0},
    {0, 0, 1}, {35, 0, 1}, {35, 10, 1}, {0, 10, 1},
    {0, 100, 0}, {35, 100, 0}, {0, 100, 1}, {35, 100, 1},
    {-20, 0, 0}, {-20, 0, 0}, {-20, 0, 1}, {-20, 10, 0},
    {-20, 10, 1}, {-20, 100, 0}, {-20, 100, 1}}];

numb = Range[0, Length[corrd] - 1];

Graphics3D[
 Text[
    Style[
     ToString[#[[1]]],
     14,
     Bold,
     ColorData["TemperatureMap"][#[[2, 3]]]], #[[2]]] & /@
  Transpose[{numb, corrd}],
 BoxRatios -> {1, 1, 1/2},
 Axes -> True]

enter image description here

$\endgroup$
  • $\begingroup$ Wow. Thanks a lot ! This is a very nice solution. $\endgroup$ – james May 13 '17 at 19:34
2
$\begingroup$

You can just use Graphics3D. Something like this can be done without any styling:

numb = Range[19];

Graphics3D[MapThread[{Red, Text[#2, #1], Point[#1]} &, {corrd, numb}],
  Axes -> True, BoxRatios -> {1, 1, 0.5}]
$\endgroup$
  • $\begingroup$ Nice ! Thanks a lot ! $\endgroup$ – james May 13 '17 at 14:16

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.