2
$\begingroup$

(Sorry if this is a duplicate, I searched briefly and didn't find anything.)

I have region plots in 3D like:

RegionPlot3D[x <= 5 && y + z <= 7 && x + y <= 8 && z <= 5, {x, 0, 10}, {y, 0, 10}, {z, 0, 10}]

I have been messing around with the Mesh parameter trying to get the mesh lines to correspond to unit lengths along the axes. But when features of the plot change (e.g., the constants 5, 7, 8) the mesh no longer shows me integer cross-sections of the axes.

Is there a value of Mesh, or perhaps MeshFunctions, that will place the mesh lines onto integer values of the axes?

$\endgroup$

1 Answer 1

4
$\begingroup$
RegionPlot3D[x <= 5 && y + z <= 7 && x + y <= 8 && z <= 5, {x, 0, 10}, {y, 0, 10}, {z, 0, 10},
 Mesh -> {{1, 2, 3, 4, 5}, {1, 2, 3, 4, 5}}]

or

RegionPlot3D[x <= 5 && y + z <= 7 && x + y <= 8 && z <= 5, {x, 0, 10}, {y, 0, 10}, {z, 0, 10},
 Mesh -> 10, MeshFunctions -> {Floor[#1] &, Floor[#2] &}]

enter image description here

$\endgroup$
1
  • $\begingroup$ Cute! Thanks. I understand MeshFunctions now. (: $\endgroup$
    – Harold
    Oct 15, 2014 at 3:39

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.