4
$\begingroup$

I'm having difficulties with FaceGrids. This should be pretty basic, but the documentation isn't helpfull with its fancy and mostly useless examples (again!)

I just want to add 2 lines on the middle of each of the 6 faces of the bounding box.

Here's a MWE showing 6 lines on two faces :

ParametricPlot3D[{t Cos[6 t], Sin[4 t], t}, {t, 0, 2 Pi},
    PlotRange -> {{-1, 1}, {-1, 1}, {-1, 1}},
    Boxed -> True,
    BoxStyle -> Directive[GrayLevel[0.8]],
    FaceGrids -> {{0, 0, 1}, {0, 0, -1}}, (* How to make sense of this ? *)
    FaceGridsStyle -> Directive[LightGray, Dashed],
    AxesOrigin -> {0, 0, 0},
    Ticks -> True,
    Lighting -> "Neutral",
    SphericalRegion -> True,
    Method -> {"RotationControl" -> "Globe"},
    ImageSize -> {700, 700}
]

Six face lines is too much. I need only two lines, on the middle of each of the 6 faces of the cube.

$\endgroup$
3
$\begingroup$

I think I got it. Is there a simpler way of doing this ?

FaceGrids -> {
    {{1, 0, 0}, {{0}, {0}}},
    {{-1, 0, 0}, {{0}, {0}}},
    {{0, 1, 0}, {{0}, {0}}},
    {{0, -1, 0}, {{0}, {0}}},
    {{0, 0, 1}, {{0}, {0}}},
    {{0, 0, -1}, {{0}, {0}}}
 }

cube with grid

Unless there's a simpler way of doing this (?), here's a nice alternative to the reference box :

ParametricPlot3D[{t Cos[6 t], Sin[4 t], t}, {t, 0, 2 Pi}, 
    PlotRange -> {{-1, 1}, {-1, 1}, {-1, 1}}, Boxed -> True, 
    BoxStyle -> Directive[GrayLevel[1]],
    FaceGrids -> {
        {{1, 0, 0}, {{0}, {0}}},
        {{-1, 0, 0}, {{0}, {0}}},
        {{0, 1, 0}, {{0}, {0}}},
        {{0, -1, 0}, {{0}, {0}}},
        {{0, 0, 1}, {{0}, {0}}},
        {{0, 0, -1}, {{0}, {0}}}
    },
    FaceGridsStyle -> Directive[Gray, Dotted],
    AxesOrigin -> {0, 0, 0},
    Ticks -> True,
    SphericalRegion -> True,
    Method -> {"RotationControl" -> "Globe"},
    ImageSize -> {700, 700}
]

Preview :

3 reference planes

$\endgroup$
  • 2
    $\begingroup$ maybe, slightly shorter, fc = {#, {{0}, {0}}} & /@ Join[#, -#] &@IdentityMatrix[3]? $\endgroup$ – kglr Mar 27 '16 at 15:03
  • 1
    $\begingroup$ This is hard to understand (to me). It's too kryptic ! $\endgroup$ – Cham Mar 27 '16 at 15:07

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.