Screenshot instructions:
Windows
Mac
Red Hat Linux
Ubuntu
Click URL instructions:
Rightclick on ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)
From: <qubax@gm...>  20090928 22:23:14

Greetings, I would like to plot to make a figure with 3 subplots of the form (221) to (223):  each subplot should show a bar3d plot of a matrix  each subplot should have it's own title The problems: a) I don't see (nor did i find something) how i can use subplots combined with bar3d (from the mpl_toolkits.mplot3d) package. b) I don't manage to give the 3d bar plot a title. In the attached code you will see that a title is set, but it does not show up in the figure Could someone please help me out with these problems? Thanks, q  The code for the basic plot of the matrix: from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt from matplotlib.ticker import FixedFormatter, LinearLocator, FixedLocator from numpy import * psi=1/sqrt(2)*array([1, 0, 0, 1]) rho=outer(psi,psi) fig = plt.figure() ax = Axes3D(fig) elements = (len(rho) * len(rho)) xpos, ypos = meshgrid(array(range(len(rho)))+0.25, array(range(len(rho)))+0.25) xpos = xpos.flatten() ypos = ypos.flatten() zpos = zeros(elements) dx = 0.5 * ones_like(zpos) dy = dx.copy() dz = absolute(rho.flatten()) ax.set_title('absolute') ax.bar3d(xpos, ypos, zpos, dx, dy, dz, color='#F8F800') plt.show() 
From: Nicolas Bigaouette <nbigaouette@gm...>  20090929 02:11:10
Attachments:
Message as HTML

I'm not sure its possible right now to do subplots with 3D. As for the title, I cannot either put titles on any 3D graphs... 2009/9/28 <qubax@...> > Greetings, > > I would like to plot to make a figure with 3 subplots > of the form (221) to (223): >  each subplot should show a bar3d plot of a matrix >  each subplot should have it's own title > > The problems: > a) I don't see (nor did i find something) how i can > use subplots combined with bar3d (from the mpl_toolkits.mplot3d) > package. > > b) I don't manage to give the 3d bar plot a title. In the attached > code you will see that a title is set, but it does not show > up in the figure > > Could someone please help me out with these problems? > > Thanks, > q > >  > > The code for the basic plot of the matrix: > > > from mpl_toolkits.mplot3d import Axes3D > import matplotlib.pyplot as plt > from matplotlib.ticker import FixedFormatter, LinearLocator, FixedLocator > from numpy import * > > psi=1/sqrt(2)*array([1, 0, 0, 1]) > rho=outer(psi,psi) > > fig = plt.figure() > > ax = Axes3D(fig) > > elements = (len(rho) * len(rho)) > xpos, ypos = meshgrid(array(range(len(rho)))+0.25, > array(range(len(rho)))+0.25) > > xpos = xpos.flatten() > ypos = ypos.flatten() > zpos = zeros(elements) > > dx = 0.5 * ones_like(zpos) > dy = dx.copy() > dz = absolute(rho.flatten()) > > ax.set_title('absolute') > > ax.bar3d(xpos, ypos, zpos, dx, dy, dz, color='#F8F800') > > plt.show() > > > > >  > Come build with us! The BlackBerry® Developer Conference in SF, CA > is the only developer event you need to attend this year. Jumpstart your > developing skills, take BlackBerry mobile applications to market and stay > ahead of the curve. Join us from November 912, 2009. Register now! > http://p.sf.net/sfu/devconf > _______________________________________________ > Matplotlibusers mailing list > Matplotlibusers@... > https://lists.sourceforge.net/lists/listinfo/matplotlibusers > 
From: JaeJoon Lee <lee.j.joon@gm...>  20090929 03:52:42

Try below instead of Axes3D. Obviously, "131" is the geometry parameter for subplot command. You don't need to add "ax" to "fig" since Axes3D do that by itself. from matplotlib.axes import subplot_class_factory Subplot3D = subplot_class_factory(Axes3D) ax = Subplot3D(fig, 131) This will show you the title also. However, the 3d axes will occupy smaller area than the area of the subplot. Regards, JJ On Mon, Sep 28, 2009 at 6:23 PM, <qubax@...> wrote: > Greetings, > > I would like to plot to make a figure with 3 subplots > of the form (221) to (223): >  each subplot should show a bar3d plot of a matrix >  each subplot should have it's own title > > The problems: > a) I don't see (nor did i find something) how i can > use subplots combined with bar3d (from the mpl_toolkits.mplot3d) > package. > > b) I don't manage to give the 3d bar plot a title. In the attached > code you will see that a title is set, but it does not show > up in the figure > > Could someone please help me out with these problems? > > Thanks, > q > >  > > The code for the basic plot of the matrix: > > > from mpl_toolkits.mplot3d import Axes3D > import matplotlib.pyplot as plt > from matplotlib.ticker import FixedFormatter, LinearLocator, FixedLocator > from numpy import * > > psi=1/sqrt(2)*array([1, 0, 0, 1]) > rho=outer(psi,psi) > > fig = plt.figure() > > ax = Axes3D(fig) > > elements = (len(rho) * len(rho)) > xpos, ypos = meshgrid(array(range(len(rho)))+0.25, array(range(len(rho)))+0.25) > > xpos = xpos.flatten() > ypos = ypos.flatten() > zpos = zeros(elements) > > dx = 0.5 * ones_like(zpos) > dy = dx.copy() > dz = absolute(rho.flatten()) > > ax.set_title('absolute') > > ax.bar3d(xpos, ypos, zpos, dx, dy, dz, color='#F8F800') > > plt.show() > > > >  > Come build with us! The BlackBerry® Developer Conference in SF, CA > is the only developer event you need to attend this year. Jumpstart your > developing skills, take BlackBerry mobile applications to market and stay > ahead of the curve. Join us from November 912, 2009. Register now! > http://p.sf.net/sfu/devconf > _______________________________________________ > Matplotlibusers mailing list > Matplotlibusers@... > https://lists.sourceforge.net/lists/listinfo/matplotlibusers > 
From: <qubax@gm...>  20090929 10:22:37

Thanks, that works like a charm. final bonus question: How can i individually set the point of view/zoom level for the different 3d subplots? Currently, when i rotate/zoom (with the mouse) in one subplot, the changes are applied on all 3d subplots. Thanks again, q On Mon, Sep 28, 2009 at 11:52:08PM 0400, JaeJoon Lee wrote: > Try below instead of Axes3D. Obviously, "131" is the geometry > parameter for subplot command. You don't need to add "ax" to "fig" > since Axes3D do that by itself. > > from matplotlib.axes import subplot_class_factory > Subplot3D = subplot_class_factory(Axes3D) > > ax = Subplot3D(fig, 131) > > This will show you the title also. However, the 3d axes will occupy > smaller area than the area of the subplot. > > Regards, > > JJ > > > On Mon, Sep 28, 2009 at 6:23 PM, <qubax@...> wrote: > > Greetings, > > > > I would like to plot to make a figure with 3 subplots > > of the form (221) to (223): > >  each subplot should show a bar3d plot of a matrix > >  each subplot should have it's own title > > > > The problems: > > a) I don't see (nor did i find something) how i can > > use subplots combined with bar3d (from the mpl_toolkits.mplot3d) > > package. > > > > b) I don't manage to give the 3d bar plot a title. In the attached > > code you will see that a title is set, but it does not show > > up in the figure > > > > Could someone please help me out with these problems? > > > > Thanks, > > q > > > >  > > > > The code for the basic plot of the matrix: > > > > > > from mpl_toolkits.mplot3d import Axes3D > > import matplotlib.pyplot as plt > > from matplotlib.ticker import FixedFormatter, LinearLocator, FixedLocator > > from numpy import * > > > > psi=1/sqrt(2)*array([1, 0, 0, 1]) > > rho=outer(psi,psi) > > > > fig = plt.figure() > > > > ax = Axes3D(fig) > > > > elements = (len(rho) * len(rho)) > > xpos, ypos = meshgrid(array(range(len(rho)))+0.25, array(range(len(rho)))+0.25) > > > > xpos = xpos.flatten() > > ypos = ypos.flatten() > > zpos = zeros(elements) > > > > dx = 0.5 * ones_like(zpos) > > dy = dx.copy() > > dz = absolute(rho.flatten()) > > > > ax.set_title('absolute') > > > > ax.bar3d(xpos, ypos, zpos, dx, dy, dz, color='#F8F800') > > > > plt.show() > > > > > > > >  > > Come build with us! The BlackBerry® Developer Conference in SF, CA > > is the only developer event you need to attend this year. Jumpstart your > > developing skills, take BlackBerry mobile applications to market and stay > > ahead of the curve. Join us from November 912, 2009. Register now! > > http://p.sf.net/sfu/devconf > > _______________________________________________ > > Matplotlibusers mailing list > > Matplotlibusers@... > > https://lists.sourceforge.net/lists/listinfo/matplotlibusers > >  The king who needs to remind his people of his rank, is no king. To gain that which is worth having, it may be necessary to lose everything else. 
From: JaeJoon Lee <lee.j.joon@gm...>  20090929 15:06:18

Hmm, axes3d does not seem to support it currently. I hope Reinier or others confirm this. Anyhow, here is a quick workaround you may try. from matplotlib.axes import subplot_class_factory class MyAxes3D(Axes3D): def _button_press(self, event): if event.inaxes == self: Axes3D._button_press(self, event) Subplot3D = subplot_class_factory(MyAxes3D) This makes rotate/zoom is effective only in the axes where the initial buttonpress event occurred. While I think it is reasonable to have Subplot3D and above fix in place, I'll defer this to Reinier or others who better know how Axes3D works. Regards, JJ On Tue, Sep 29, 2009 at 6:22 AM, <qubax@...> wrote: > Thanks, > > that works like a charm. > > final bonus question: How can i individually set the point of view/zoom level > for the different 3d subplots? > > Currently, when i rotate/zoom (with the mouse) in one subplot, the changes > are applied on all 3d subplots. > > Thanks again, > q > > On Mon, Sep 28, 2009 at 11:52:08PM 0400, JaeJoon Lee wrote: >> Try below instead of Axes3D. Obviously, "131" is the geometry >> parameter for subplot command. You don't need to add "ax" to "fig" >> since Axes3D do that by itself. >> >> from matplotlib.axes import subplot_class_factory >> Subplot3D = subplot_class_factory(Axes3D) >> >> ax = Subplot3D(fig, 131) >> >> This will show you the title also. However, the 3d axes will occupy >> smaller area than the area of the subplot. >> >> Regards, >> >> JJ >> >> >> On Mon, Sep 28, 2009 at 6:23 PM, <qubax@...> wrote: >> > Greetings, >> > >> > I would like to plot to make a figure with 3 subplots >> > of the form (221) to (223): >> >  each subplot should show a bar3d plot of a matrix >> >  each subplot should have it's own title >> > >> > The problems: >> > a) I don't see (nor did i find something) how i can >> > use subplots combined with bar3d (from the mpl_toolkits.mplot3d) >> > package. >> > >> > b) I don't manage to give the 3d bar plot a title. In the attached >> > code you will see that a title is set, but it does not show >> > up in the figure >> > >> > Could someone please help me out with these problems? >> > >> > Thanks, >> > q >> > >> >  >> > >> > The code for the basic plot of the matrix: >> > >> > >> > from mpl_toolkits.mplot3d import Axes3D >> > import matplotlib.pyplot as plt >> > from matplotlib.ticker import FixedFormatter, LinearLocator, FixedLocator >> > from numpy import * >> > >> > psi=1/sqrt(2)*array([1, 0, 0, 1]) >> > rho=outer(psi,psi) >> > >> > fig = plt.figure() >> > >> > ax = Axes3D(fig) >> > >> > elements = (len(rho) * len(rho)) >> > xpos, ypos = meshgrid(array(range(len(rho)))+0.25, array(range(len(rho)))+0.25) >> > >> > xpos = xpos.flatten() >> > ypos = ypos.flatten() >> > zpos = zeros(elements) >> > >> > dx = 0.5 * ones_like(zpos) >> > dy = dx.copy() >> > dz = absolute(rho.flatten()) >> > >> > ax.set_title('absolute') >> > >> > ax.bar3d(xpos, ypos, zpos, dx, dy, dz, color='#F8F800') >> > >> > plt.show() >> > >> > >> > >> >  >> > Come build with us! The BlackBerry® Developer Conference in SF, CA >> > is the only developer event you need to attend this year. Jumpstart your >> > developing skills, take BlackBerry mobile applications to market and stay >> > ahead of the curve. Join us from November 912, 2009. Register now! >> > http://p.sf.net/sfu/devconf >> > _______________________________________________ >> > Matplotlibusers mailing list >> > Matplotlibusers@... >> > https://lists.sourceforge.net/lists/listinfo/matplotlibusers >> > > >  > The king who needs to remind his people of his rank, is no king. > > To gain that which is worth having, it may be necessary to lose everything else. > 
From: Reinier Heeres <reinier@he...>  20090930 08:32:06

Hi, I will have a look at mplot3d subplots next weekend and try to fix issues like this. I'll also add a working example. Cheers, Reinier On Tue, Sep 29, 2009 at 5:05 PM, JaeJoon Lee <lee.j.joon@...> wrote: > Hmm, axes3d does not seem to support it currently. I hope Reinier or > others confirm this. > Anyhow, here is a quick workaround you may try. > > > from matplotlib.axes import subplot_class_factory > > class MyAxes3D(Axes3D): > def _button_press(self, event): > if event.inaxes == self: > Axes3D._button_press(self, event) > > > Subplot3D = subplot_class_factory(MyAxes3D) > > This makes rotate/zoom is effective only in the axes where the initial > buttonpress event occurred. > > While I think it is reasonable to have Subplot3D and above fix in > place, I'll defer this to Reinier or others who better know how Axes3D > works. > > Regards, > > JJ > > > On Tue, Sep 29, 2009 at 6:22 AM, <qubax@...> wrote: >> Thanks, >> >> that works like a charm. >> >> final bonus question: How can i individually set the point of view/zoom level >> for the different 3d subplots? >> >> Currently, when i rotate/zoom (with the mouse) in one subplot, the changes >> are applied on all 3d subplots. >> >> Thanks again, >> q >> >> On Mon, Sep 28, 2009 at 11:52:08PM 0400, JaeJoon Lee wrote: >>> Try below instead of Axes3D. Obviously, "131" is the geometry >>> parameter for subplot command. You don't need to add "ax" to "fig" >>> since Axes3D do that by itself. >>> >>> from matplotlib.axes import subplot_class_factory >>> Subplot3D = subplot_class_factory(Axes3D) >>> >>> ax = Subplot3D(fig, 131) >>> >>> This will show you the title also. However, the 3d axes will occupy >>> smaller area than the area of the subplot. >>> >>> Regards, >>> >>> JJ >>> >>> >>> On Mon, Sep 28, 2009 at 6:23 PM, <qubax@...> wrote: >>> > Greetings, >>> > >>> > I would like to plot to make a figure with 3 subplots >>> > of the form (221) to (223): >>> >  each subplot should show a bar3d plot of a matrix >>> >  each subplot should have it's own title >>> > >>> > The problems: >>> > a) I don't see (nor did i find something) how i can >>> > use subplots combined with bar3d (from the mpl_toolkits.mplot3d) >>> > package. >>> > >>> > b) I don't manage to give the 3d bar plot a title. In the attached >>> > code you will see that a title is set, but it does not show >>> > up in the figure >>> > >>> > Could someone please help me out with these problems? >>> > >>> > Thanks, >>> > q >>> > >>> >  >>> > >>> > The code for the basic plot of the matrix: >>> > >>> > >>> > from mpl_toolkits.mplot3d import Axes3D >>> > import matplotlib.pyplot as plt >>> > from matplotlib.ticker import FixedFormatter, LinearLocator, FixedLocator >>> > from numpy import * >>> > >>> > psi=1/sqrt(2)*array([1, 0, 0, 1]) >>> > rho=outer(psi,psi) >>> > >>> > fig = plt.figure() >>> > >>> > ax = Axes3D(fig) >>> > >>> > elements = (len(rho) * len(rho)) >>> > xpos, ypos = meshgrid(array(range(len(rho)))+0.25, array(range(len(rho)))+0.25) >>> > >>> > xpos = xpos.flatten() >>> > ypos = ypos.flatten() >>> > zpos = zeros(elements) >>> > >>> > dx = 0.5 * ones_like(zpos) >>> > dy = dx.copy() >>> > dz = absolute(rho.flatten()) >>> > >>> > ax.set_title('absolute') >>> > >>> > ax.bar3d(xpos, ypos, zpos, dx, dy, dz, color='#F8F800') >>> > >>> > plt.show() >>> > >>> > >>> > >>> >  >>> > Come build with us! The BlackBerry® Developer Conference in SF, CA >>> > is the only developer event you need to attend this year. Jumpstart your >>> > developing skills, take BlackBerry mobile applications to market and stay >>> > ahead of the curve. Join us from November 912, 2009. Register now! >>> > http://p.sf.net/sfu/devconf >>> > _______________________________________________ >>> > Matplotlibusers mailing list >>> > Matplotlibusers@... >>> > https://lists.sourceforge.net/lists/listinfo/matplotlibusers >>> > >> >>  >> The king who needs to remind his people of his rank, is no king. >> >> To gain that which is worth having, it may be necessary to lose everything else. >> > >  > Come build with us! The BlackBerry® Developer Conference in SF, CA > is the only developer event you need to attend this year. Jumpstart your > developing skills, take BlackBerry mobile applications to market and stay > ahead of the curve. Join us from November 912, 2009. Register now! > http://p.sf.net/sfu/devconf > _______________________________________________ > Matplotlibusers mailing list > Matplotlibusers@... > https://lists.sourceforge.net/lists/listinfo/matplotlibusers >  Reinier Heeres Tel: +31 6 10852639 