I have three variables, x
, y
and z
, and I would like to plot the following region (shaded) in a 3D plot:
1 < x < 4, 5 < y < 10, -6 <z <-2
Is there any way I can do that?
Thank you!
I have three variables, x
, y
and z
, and I would like to plot the following region (shaded) in a 3D plot:
1 < x < 4, 5 < y < 10, -6 <z <-2
Is there any way I can do that?
Thank you!
Here is the code:
The tricky point: the original cube
c3d
is -1 <= x,y,z <= 1. The corners are listed inc3d$vb
as 8 columns. I converted the original corners to the new corners. For instance about the x-axis (first row ofc3d$vb
) we want to convert (-1,1) to (1, 4). This is done by a factor of (4-1)/(1-(-1))=1.5, which converts (-1,1) to (-1.5, 1.5). Then by adding 4-1.5 = 2.5 we will have (1,4).If you are interested to have the axes origin in your plot, you may add plot3d(0,0,0) before shade3d(c3d) - I am sure there are better solutions to this - and you will have: