# rectangle 3D with transparency

Dear all,

I need to plot a 2D rectangle in a 3D plot.

I already know how to put a circle. I have started from:

http://matplotlib.org/examples/mplot3d/pathpatch3d_demo.html

and inserting the alpha parameter.

p = Circle((5, 5), 2,alpha=0.1)

art3d.pathpatch_2d_to_3d(p, z=5,zdir=“y”)

How can I do the same but with a rectangle instead of a circle?

Thanks all

Diego

Just change a couple of lines:
- from matplotlib.patches import Circle, PathPatch
+ from matplotlib.patches import Rectangle, PathPatch

and
- p = Circle((5,5), 3)
+ p = Rectangle((1,1), 2, 4)

···

On Wed, Dec 26, 2012 at 6:49 AM, Diego Avesani <diego.avesani@...287...>wrote:

Dear all,
I need to plot a 2D rectangle in a 3D plot.

I already know how to put a circle. I have started from:
http://matplotlib.org/examples/mplot3d/pathpatch3d_demo.html
and inserting the alpha parameter.

*p = Circle((5, 5), 2,alpha=0.1)*
*art3d.pathpatch_2d_to_3d(p, z=5,zdir="y")*
*
*
How can I do the same but with a rectangle instead of a circle?

Thanks all

dear Paul,

thanks a lot

it works

Diego

···

Dear all,
I need to plot a 2D rectangle in a 3D plot.

I already know how to put a circle. I have started from:

http://matplotlib.org/examples/mplot3d/pathpatch3d_demo.html

and inserting the alpha parameter.

p = Circle((5, 5), 2,alpha=0.1)

art3d.pathpatch_2d_to_3d(p, z=5,zdir=“y”)

How can I do the same but with a rectangle instead of a circle?

Thanks all

Just change a couple of lines:

• from matplotlib.patches import Circle, PathPatch
• from matplotlib.patches import Rectangle, PathPatch

and

• p = Circle((5,5), 3)
• p = Rectangle((1,1), 2, 4)