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?


1 Answer 1


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.


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.