Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mathematica: Help me understand Mathematica 3D coordinates system

I gave up trying to understand Mathematica 3D axes configuration.

When I make 3D plot, and label the 3 axes to identify which axes is which, and then make points on these axes, the points appear on different axes than what I expect them to show at using the Point command, which takes {x,y,z} coordinates.

Here is an example

g=Graphics3D[
  {
   {PointSize[0],Point[{0,0,0}]}
  },
  AxesOrigin->{0,0,0}, PlotRange->{{-3,3},{-3,3},{-3,3}},
  Axes->True, AxesLabel->{"X","Y","Z"},
  LabelStyle->Directive[Bold,Red,16],
  PreserveImageOptions->False, Ticks->None,Boxed->False]

The above results in

enter image description here

So, now I added a point at at end of the x-axis, and at the end of the y-axis, and at the end of the z-axis. I make each point different color to help identify them on the plot.

 g=Graphics3D[
 {
  {Red,PointSize[.03],Point[{3,0,0}]},
  {Black,PointSize[.03],Point[{0,3,0}]},
  {Blue,PointSize[.03],Point[{0,0,3}]}
 },
  AxesOrigin->{0,0,0},PlotRange->{{-3,3},{-3,3},{-3,3}},
  Axes->True,AxesLabel->{"X","Y","Z"},
  LabelStyle->Directive[Bold,Red,16],PreserveImageOptions->False,
  Ticks->None,Boxed->False]

The result is this:

enter image description here

You can see, the RED point, which I expected it to go to end of the x-axis, shows up at the end of the Z axis. And the Black point, instead of showing up at the end of the Y-axis, shows up at X-axis, and the blue point, instead of showing at the end of the Z axis, shows up at the end of the Y-axis.

May be the labels are wrong? May be I am looking at the image in wrong way?

I am really confused, as I am clearly not understanding something. I looked at documentation, and I could not find something to help me see what I am doing wrong. I am just starting to learn Mathematica 3D graphics.

EDIT: add image with Ticks on it, reply to Simon, I did not know how to do it the comment box:

 g=Graphics3D[
 {
   Cuboid[{-.1,-.1,-.1},{.1,.1,.1}],
   {Red,PointSize[.03],Point[{2,0,0}]},
   {Black,PointSize[.03],Point[{0,2,0}]},
   {Blue,PointSize[.03],Point[{0,0,2}]}
  },
   AxesOrigin->{0,0,0},
   PlotRange->{{-2,2},{-2,2},{-2,2}},
   Axes->True,
   AxesLabel->{"X","Y","Z"},
   LabelStyle->Directive[Bold,Red,16],
   PreserveImageOptions->False,
   Ticks->True, TicksStyle->Directive[Black,8],
   Boxed->False
   ]

here is the result: enter image description here

EDIT: OK, I decided to forget about using AxesLabels, and I put them myself . Much more clear now

m=3;
labels={Text[Style["X",16],{1.2 m,0,0}],Text[Style["Y",16],{0,1.2 m,0}],
       Text[Style["Z",16],{0,0,1.2 m}]};

 g=Graphics3D[
 {
   {Red,PointSize[.03],Point[{m,0,0}]},
   {Black,PointSize[.03],Point[{0,m,0}]},
   {Blue,PointSize[.03],Point[{0,0,m}]},
   labels
 },
  AxesOrigin->{0,0,0},
  PlotRange->{{-m,m},{-m,m},{-m,m}},
  Axes->True,
  AxesLabel->None,
  LabelStyle->Directive[Bold,Red,16],
  PreserveImageOptions->False,
  Ticks->True, TicksStyle->Directive[Black,8],
  Boxed->False
  ]

enter image description here

like image 452
Nasser Avatar asked May 31 '11 03:05

Nasser


2 Answers

I agree with you that AxesLabel for 3D graphics is next to worthless. Look at the effects of a small interactive viewpoint change on your figure:

[enter image description here]

IMHO WRI should really improve the operation of this option, and preferably provide some more placement control too (end/mid of axes etc.).

like image 124
Sjoerd C. de Vries Avatar answered Sep 22 '22 06:09

Sjoerd C. de Vries


I believe the labels are being placed in unintuitive spots. Replacing your dots with colored lines of different length is clearer to me. I've also removed the explicit plot range which helps Mathematica put the labels in much clearer places.

 g=Graphics3D[
{
 {Red,Thick, Line[{{0, 0, 0}, {1, 0, 0}}]},
 {Black,Thick, Line[{{0, 0, 0}, {0, 2, 0}}]},
 {Blue,Thick, Line[{{0, 0, 0}, {0, 0, 3}}]}
},
 AxesOrigin->{0,0,0},
 Axes->True,AxesLabel->{"X","Y","Z"},
 LabelStyle->Directive[Bold,Red,16],PreserveImageOptions->False,
 Ticks->None,Boxed->False]

enter image description here

like image 44
Joshua Martell Avatar answered Sep 20 '22 06:09

Joshua Martell