Message Boards Message Boards

0
|
10508 Views
|
7 Replies
|
2 Total Likes
View groups...
Share
Share this post:

Cartesian Grid in 3D Plot?

Posted 8 years ago

I find it very difficult to understand many 3D plots when I see them visualized and I'm given nothing more then three axes to look at. For example, in the following image (randomly obtained from the internet):

enter image description here

The grid around the equation makes it significantly easier understand the equation than without the grid and with only the axes; it makes it easier to see what points the equation goes through. However, in Wolfram Mathematica 10, I do not know if there is a way to create a 3D grid or not (I don't even know how to make a 2D one.)

So, for example, in the following code:

ParametricPlot3D[{{x, Im[I^x], Re[I^x]}}, {x, -4, 4}, AxesLabel -> {Real x, Imaginary y, Real y}, PlotRange -> All]

enter image description here

Notice that there is no 3D grid; just the axes and the bounding box. Is there a way to add a 3D grid to this? it would make it much easier to visualize what's happening in more complicated plots like these.

Also, it would be very, very useful if the grid lines moving along the three different axes could be color coded corresponding to the axis it represents. For example, the grid lines parallel to the "Imaginary y" axis could be blue and the grid lines parallel to the "Real y" could be red so that way it would be even easier to differentiate what's happening as my Real input X changes.

Simply put, is this possible in Mathematica?

POSTED BY: John Travolski
7 Replies

I was aware of that when I sent you the solution. Unfortunately the Opacity is not "so perfectly" implemented. You can (manually, using the mouse) rotate the figure to make it to display continuous lines yehuda

Posted 8 years ago

Yehuda, your third solution is very useful! I like both of yours, though, and I believe that I'll have uses for both of them. I appreciate all of your work. However, I'm curious; I'm noticing this and I want to know what you think about it:

enter image description here

enter image description here

Whenever I have all 3 of those planes showing simultaneously, it seems that parts of the graph are "cut off" as you can see by the two images above. The problem doesn't exist whenever I select any combination of only two planes; only when all three are selected. Changing the opacity down all the way to zero still gives the same problem. Do you have any idea what's causing this?

POSTED BY: John Travolski

Following Bianca's ideas of planes I made another implementation (very similar, but works with Polygons), and you can play with opacity and which plane to show. This will direct you how to proceed yehuda

Manipulate[
 Module[{xticks, yticks, zticks, xends, yends, zends, xplanes, 
   yplanes, zplanes}, xticks = yticks = zticks = Range[-1, 1, 0.5];
  xends = yends = zends = {-1, 1};

  xplanes = 
   Apply[Polygon[Join[#, Reverse[#2]]] &, 
    Outer[{#3, #1, #2} &, yticks, zends, xends], 1];
  yplanes =
   Apply[Polygon[Join[#, Reverse[#2]]] &, 
    Outer[{#2, #3, #1} &, zticks, xends, yends], 1];
  zplanes = 
   Apply[Polygon[Join[#, Reverse[#2]]] &, 
    Outer[{##} &, xticks, yends, zends], 1];
  Show[ParametricPlot3D[{{x, Im[I^(5 x)], Re[I^(5 x)]}}, {x, -1, 1}, 
    AxesLabel -> {"Real x", "Imaginary y", "Real y"}, 
    PlotRange -> All, PlotStyle -> {Thick, Red}],
   Graphics3D[
    Flatten[{Opacity[opacity], Gray, 
      If[#[[1]], #[[2]], {}] & /@ 
       Thread[{{xp, yp, zp}, {xplanes, yplanes, zplanes}}]
      }]]]], {{opacity, 0.1}, 0, 
  0.5}, {xp, {True, False}}, {yp, {True, False}}, {zp, {True, 
   False}}]

Of course you can do that, but it will just clutter your graphics one simple example of doing that is given below to show how it can be done and how the clutter looks like. Notice that I didn't make any effort to optimize anything, nor to make it general. best yehuda

Module[{xticks, yticks, zticks, xends, yends, zends},
 xticks = yticks = zticks = Range[-1, 1, 0.5];
 xends = yends = zends = {-1, 1};
 Show[ParametricPlot3D[{{x, Im[I^(5 x)], Re[I^(5 x)]}}, {x, -1, 1}, 
   AxesLabel -> {"Real x", "Imaginary y", "Real y"}, PlotRange -> All,
    PlotStyle -> {Thick, Red}], 
  Graphics3D[
   Flatten@{Blue, 
     Map[Line, Outer[{#3, #1, #2} &, yticks, zticks, xends], {2}], 
     Map[Line, Outer[{#1, #3, #2} &, xticks, zticks, yends], {2}],
     Map[Line, Outer[{##} &, xticks, yticks, zends], {2}]}], 
  ImageSize -> 500]]

You can always use Show to combine your plot with a Graphics3D containing the lines you want. That may or may not be worth the trouble... You can also use semi-transparent planes running through the plot instead, that may actually be more helpful as a visual guide depending on the features you want to highlight.

POSTED BY: Bianca Eifert
Posted 8 years ago

Thanks, that helps greatly. Is there a way that I can choose the intervals for those?

Also, although the face grids are useful, is there a way to actually create a grid that actually goes through the box? Like this (just with fewer grid lines): http://i.stack.imgur.com/XdmEw.png

POSTED BY: John Travolski

Hi You may use the FaceGrid option along with FaceGridStyle to make this happen

ParametricPlot3D[{{x, Im[I^x], Re[I^x]}}, {x, -4, 4}, 
 AxesLabel -> {"Real x", "Imaginary y", "Real y"}, PlotRange -> All, 
 FaceGrids -> All, FaceGridsStyle -> {Red, Green, Blue}]

and it will look like

enter image description here

yehuda

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract