12
$\begingroup$

I want to plot a 3D graphic and I want facegrids at the ticks that I specify. I've tried several solutions but I cannot get this working. The result with the code provided below is that it does its job except in the x-axis where it only draws a facegrid at the middle coordinate (and not in all ticks). Any advice is most welcome.

Here is my code:

Plot3D[exp[R, bn, 50], {R, 2, 100}, {bn, 1, 5},
       AxesStyle -> Thickness[0.005],
       Ticks -> {{2, 10, 20, 30, 50, 100}, {1, 2, 3, 4, 5}, 
                 {0.5, 1.0,1.5, 2.0, 2.5}}, 
       Boxed -> False,
       Mesh -> {{0, 2, 5, 10, 15, 20, 30, 40, 50, 60, 70, 80, 90, 100}, 
                {1,1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5}}, 
       PerformanceGoal -> "Quality",
       FaceGrids -> All,
       AxesLabel -> {"X","Y","Z"}
]

Mathematica graphics

$\endgroup$
1

1 Answer 1

15
$\begingroup$

This can be found on the 'More Information' section of the FaceGrid doc page though it may not be very easy to grasp. Here's an example:

Plot3D[Sin[R bn/10], {R, 2, 100}, {bn, 1, 5}, 
 AxesStyle -> Thickness[0.005], 
 Ticks -> {{2, 10, 20, 30, 50, 100}, {1, 2, 3, 4, 5}, {0.5, 1.0, 1.5, 2.0, 2.5}},
 Boxed -> False, 
 Mesh -> {{0, 2, 5, 10, 15, 20, 30, 40, 50, 60, 70, 80, 90, 100}, 
          {1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5}}, 
 PerformanceGoal -> "Quality", 
 FaceGrids -> 
   {{{0, -1, 0}, {{2, 10, 20, 30, 50, 100}, {0.5, 1.0, 1.5, 2.0, 2.5}}}, 
    {{1,  0, 0}, {{1, 2, 3, 4, 5}, {0.5, 1.0, 1.5, 2.0, 2.5}}}, 
    {{0, 0,  1}, {{2, 10, 20, 30, 50, 100}, {1, 2, 3, 4, 5}}}
   }
]

Mathematica graphics

Basically what Facegrid specifies here is which faces to draw and what lines to draw in each face. For each face, we need one list. An identification of the grid we are talking about is the first element of each face grid specification. This specification can be thought of the unit vector pointing straight to the grid you want to indicate, so {1,0,0} would be the $+x$ face grid, and {0,-1,0} would be the $-y$ grid. The next element of the grid specification list is a specification of the grid lines, a list with tick values for each of the remaining coordinates. So, if the $+x$ grid is being specified this list contains a specification for the $y$ and $z$ ticks.

$\endgroup$
1
  • $\begingroup$ Thanks a lot! I was about to hit my head into the wall! :) $\endgroup$
    – jpcgandre
    Commented Mar 29, 2012 at 22:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.