3
$\begingroup$

I have an inequality which looks like

5 < x < 25 && 5 < y < 25 && z == 3

And I would like to plot this surface. However, RegionPlot3D returns a blank when z==3.

RegionPlot3D[ 5 < x < 25 && 5 < y < 25 && z == 3, {x, 0, 30}, {y, 0, 30}, {z, 0, 5}]

enter image description here

I have to manually change the z equality to something like

  RegionPlot3D[ 5 < x < 25 && 5 < y < 25 && 2.8 < z < 3, {x, 0, 30}, {y, 0, 30}, {z, 0, 5}]

enter image description here

Is there a better way to plot this surface?

$\endgroup$
  • 1
    $\begingroup$ Is this a general question? Because if not then you can just use Polygon here. $\endgroup$ – Kuba Feb 24 '18 at 11:02
6
$\begingroup$

For arbitrary implicite regions it is easy to use:

R = ImplicitRegion[5 < x < 25 && 5 < y < 25 && z == 3, {x, y, z}];
Region[R, PlotRange -> {{0, 30}, {0, 30}, {0, 5}}, Boxed -> True,Axes -> True]

enter image description here

$\endgroup$
3
$\begingroup$

There is a simple workaround.

Choose PlotPoints so that there are points to be plotted at exactly z==3. For example with {z,1,5} choose 3 as the lowest odd number of PlotPoints in z direction. But in order not to get round edges, choose high numbers for x and y direction, best multiples of the x-range and y-range.

RegionPlot3D[
    5 < x < 25 && 5 < y < 25 && z == 3, {x, 0, 30}, {y, 0, 30}, {z, 1, 
    5}, PlotPoints -> {60, 60, 3}]

enter image description here

$\endgroup$

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.