Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to make a 3d plot with FaceGrids with a certain color scheme. Specifically, I'd like them to be one color below a diagonal line, and a different color above it. (So for example, on the y=0 surface, I'd like the FaceGrids to be pink below x=z, and blue above x=z.)

If I were coloring the plot itself, I'd define a ColorFunction, but it seems that FaceGrids doesn't take ColorFunction as an option. Here's an example of my best attempt:

 FaceGrids -> {{{0, -1, 
     0}, {{{-1/2, ColorFunction -> Function[{x, y, z}, Hue[z]]}, {0, 
       Green}, {1/2, Blue}}, {-1/3, {1/3, 
       Directive[Thick, Dashed]}}}}}]

Note that while the other gridlines have the properties assigned, the one with a ColorFunction is just gray.

Is there any way to have varying colors on FaceGrids?

share|improve this question

I don't think it's possible to vary the color along a mesh line. So you'll probably have to do the lines by hand:

Graphics3D[{Cylinder[], Pink, Line[{{-1/2, -1, -1}, {-1/2, -1, 0}}], 
  Blue, Line[{{-1/2, -1, 0}, {-1/2, -1, 1}}]}, 
 PlotRange -> {{-1, 1}, {-1, 1}, {-1, 1}}, 
 FaceGrids -> {{{0, -1, 
     0}, {{{0, Green}, {1/2, Blue}}, {-1/3, {1/3, 
       Directive[Thick, Dashed]}}}}}]


You can apply color functions in a way that varies the color from one line to the next, as shown for MeshStyle in this question. But I don't think that's what you meant.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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