SourceForge logo
SourceForge logo
Menu

matplotlib-users

From: Katie B. <kat...@gm...> - 2011年08月31日 00:10:43
Hi All,
I have a 2D grid comprised of 100 nodes in X, 300 nodes in Z, and a single
node in Y. I have a scalar value defined at each node point.
I want to display this planar grid in 3D by first rendering a contour plot
(no problems there) and then rotating it such that it plots as a vertical
sheet when viewed in 3D. Right now it is automatically forced to reside in
the X-Y plane, but I want it to reside in the X-Z plane. Here is an excerpt
from my code:
fig = plt.figure(figsize=(25,20))
ax = Axes3D(fig)
ax.contourf(xx, yy, zz, 100, cmp = plt.cm.jet,zdir='y',extend3D=False)
plt.hold(True)
ax.bar3d(5000, 625, 1500, 1, 1, 1, color='r')
ax.set_xlabel("X [m]")
ax.set_ylabel("Y [m]")
ax.set_zlabel("Z [m]")
plt.savefig("Feature.png",dpi=200)
I think the 'zdir' flag is supposed to do this exact task, but setting it to
'y' seems to have no effect on my plot. Also, the plot is being extended
into 3D even though I set the extend3D flag to False. Can anyone tell me
what I'm doing wrong?
Cheers!
From: Benjamin R. <ben...@ou...> - 2011年08月31日 00:22:23
On Tuesday, August 30, 2011, Katie Boyle <kat...@gm...> wrote:
> Hi All,
>
> I have a 2D grid comprised of 100 nodes in X, 300 nodes in Z, and a single
node in Y. I have a scalar value defined at each node point.
>
> I want to display this planar grid in 3D by first rendering a contour plot
(no problems there) and then rotating it such that it plots as a vertical
sheet when viewed in 3D. Right now it is automatically forced to reside in
the X-Y plane, but I want it to reside in the X-Z plane. Here is an excerpt
from my code:
>
> fig = plt.figure(figsize=(25,20))
> ax = Axes3D(fig)
> ax.contourf(xx, yy, zz, 100, cmp = plt.cm.jet,zdir='y',extend3D=False)
> plt.hold(True)
> ax.bar3d(5000, 625, 1500, 1, 1, 1, color='r')
> ax.set_xlabel("X [m]")
> ax.set_ylabel("Y [m]")
> ax.set_zlabel("Z [m]")
> plt.savefig("Feature.png",dpi=200)
>
> I think the 'zdir' flag is supposed to do this exact task, but setting it
to 'y' seems to have no effect on my plot. Also, the plot is being extended
into 3D even though I set the extend3D flag to False. Can anyone tell me
what I'm doing wrong?
>
> Cheers!
>
What version of mpl are you using? I don't think those kwargs were added
until the upcoming release, v1.1.0. Does the graph look right if you do
just contour?
Plus, from the top of my head, I don't think extend3d works for contourf
(but I could be wrong).
Ben Root
From: Katie B. <kat...@gm...> - 2011年08月31日 00:36:56
Hi Ben,
I'm using mpl 0.99 on Ubuntu 10.10, and whether I use contour or contourf I
get a plot that is laying in the X-Y plane with contour loops extending into
the +z direction. The contour plot itself looks right (if I could get it to
be 2D instead of 3D), it's just its orientation and non-planarity that pose
problems.
Cheers,
Katie
On Tue, Aug 30, 2011 at 5:22 PM, Benjamin Root <ben...@ou...> wrote:
>
>
> On Tuesday, August 30, 2011, Katie Boyle <kat...@gm...> wrote:
> > Hi All,
> >
> > I have a 2D grid comprised of 100 nodes in X, 300 nodes in Z, and a
> single node in Y. I have a scalar value defined at each node point.
> >
> > I want to display this planar grid in 3D by first rendering a contour
> plot (no problems there) and then rotating it such that it plots as a
> vertical sheet when viewed in 3D. Right now it is automatically forced to
> reside in the X-Y plane, but I want it to reside in the X-Z plane. Here is
> an excerpt from my code:
> >
> > fig = plt.figure(figsize=(25,20))
> > ax = Axes3D(fig)
> > ax.contourf(xx, yy, zz, 100, cmp = plt.cm.jet,zdir='y',extend3D=False)
> > plt.hold(True)
> > ax.bar3d(5000, 625, 1500, 1, 1, 1, color='r')
> > ax.set_xlabel("X [m]")
> > ax.set_ylabel("Y [m]")
> > ax.set_zlabel("Z [m]")
> > plt.savefig("Feature.png",dpi=200)
> >
> > I think the 'zdir' flag is supposed to do this exact task, but setting it
> to 'y' seems to have no effect on my plot. Also, the plot is being extended
> into 3D even though I set the extend3D flag to False. Can anyone tell me
> what I'm doing wrong?
> >
> > Cheers!
> >
>
> What version of mpl are you using? I don't think those kwargs were added
> until the upcoming release, v1.1.0. Does the graph look right if you do
> just contour?
>
> Plus, from the top of my head, I don't think extend3d works for contourf
> (but I could be wrong).
>
> Ben Root
From: Benjamin R. <ben...@ou...> - 2011年08月31日 01:59:43
On Tuesday, August 30, 2011, Katie Boyle <kat...@gm...> wrote:
> Hi Ben,
>
> I'm using mpl 0.99 on Ubuntu 10.10, and whether I use contour or contourf
I get a plot that is laying in the X-Y plane with contour loops extending
into the +z direction. The contour plot itself looks right (if I could get
it to be 2D instead of 3D), it's just its orientation and non-planarity that
pose problems.
>
> Cheers,
> Katie
>
Posting an image would be very helpful. In addition, I don't think v0.99
supports what you are trying to do. But perhaps the image would make things
clearer.
Ben Root
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /