Message Boards Message Boards

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

Cartesian Grid in 3D Plot?

Posted 8 years ago
POSTED BY: John Travolski
7 Replies

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

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

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

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

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

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

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