11 Jun 2012 19:09
11 Jun 2012 20:07
Re: matplotlib 3d scatter plot in Traits
On Mon, Jun 11, 2012 at 10:39 PM, Brennan Williams <brennan.williams@...> wrote: > Just a quick question to see if anyone has plotted a mplot3d scatter > plot inside a Traits dialog? > > Brennan > _______________________________________________ > Enthought-Dev mailing list > Enthought-Dev@... > https://mail.enthought.com/mailman/listinfo/enthought-dev Hi, I'm not sure if anyone has done it. But it's definitely doable. Any matplotlib plot can be put inside a traits view but it needs a separate editor. Please refer to this -http://gael-varoquaux.info/computers/traits_tutorial/traits_tutorial.html#making-a-traits-editor-from-a-matplotlib-plot
11 Jun 2012 22:34
Re: matplotlib 3d scatter plot in Traits
Got it going ok and yes I did a bit of a cut and paste of Gael's example code. I get a 3D scatter plot but I don't have the interactive zoom/pan controls working but I suppose that is hardly surprising as they are matplotlib GUI interactions rather than Traits GUI interactions. Brennan On 11/06/2012 7:07 p.m., Jaidev Deshpande wrote: > On Mon, Jun 11, 2012 at 10:39 PM, Brennan Williams > <brennan.williams@...> wrote: >> Just a quick question to see if anyone has plotted a mplot3d scatter >> plot inside a Traits dialog? >> >> Brennan >> _______________________________________________ >> Enthought-Dev mailing list >> Enthought-Dev@... >> https://mail.enthought.com/mailman/listinfo/enthought-dev > Hi, > > I'm not sure if anyone has done it. But it's definitely doable. Any > matplotlib plot can be put inside a traits view but it needs a > separate editor. Please refer to this > -http://gael-varoquaux.info/computers/traits_tutorial/traits_tutorial.html#making-a-traits-editor-from-a-matplotlib-plot > _______________________________________________ > Enthought-Dev mailing list > Enthought-Dev@... > https://mail.enthought.com/mailman/listinfo/enthought-dev >(Continue reading)
11 Jun 2012 23:16
Re: matplotlib 3d scatter plot in Traits
Hi, > I get a 3D scatter plot but I don't have the interactive zoom/pan > controls working but I suppose that is hardly surprising as they are > matplotlib GUI interactions rather than Traits GUI interactions. It is indeed possible to get the matplotlib zoom and pan operations into the dialog. Out of curiosity, which part of the MPLFigureEditor did you use? Thanks
11 Jun 2012 23:51
Re: matplotlib 3d scatter plot in Traits
On 11/06/2012 10:16 p.m., Jaidev Deshpande wrote:
> Hi,
>
>> I get a 3D scatter plot but I don't have the interactive zoom/pan
>> controls working but I suppose that is hardly surprising as they are
>> matplotlib GUI interactions rather than Traits GUI interactions.
> It is indeed possible to get the matplotlib zoom and pan operations
> into the dialog. Out of curiosity, which part of the MPLFigureEditor
> did you use?
My code.....
import matplotlib.pyplot as mplplt
from mpl_figure_editor import MPLFigureEditor
from matplotlib.figure import Figure
from mpl_toolkits.mplot3d import Axes3D
....
def create_plot(self):
....
self.figure=mplplt.figure()
ax = self.figure.add_subplot(111, projection='3d')
.....
ax.scatter(xarray, yarray, zarray, c='b', marker='o')
ax.set_xlabel(xvar.name)
ax.set_ylabel(yvar.name)
ax.set_zlabel(self.name)
mplplt.ion()
(Continue reading)
12 Jun 2012 00:28
Re: matplotlib 3d scatter plot in Traits
Got the zoom working. I was overwriting my 'figure' which led to the zoom/rotate controls not working. I just need to work out how to colour code my circles on my scatter plot now. They are all one colour. But that is a matplotlib question, not a Traits one. Thanks to Gael for his work on this. Brennan On 11/06/2012 10:51 p.m., Brennan Williams wrote: > On 11/06/2012 10:16 p.m., Jaidev Deshpande wrote: >> Hi, >> >>> I get a 3D scatter plot but I don't have the interactive zoom/pan >>> controls working but I suppose that is hardly surprising as they are >>> matplotlib GUI interactions rather than Traits GUI interactions. >> It is indeed possible to get the matplotlib zoom and pan operations >> into the dialog. Out of curiosity, which part of the MPLFigureEditor >> did you use? > My code..... > > > import matplotlib.pyplot as mplplt > from mpl_figure_editor import MPLFigureEditor > from matplotlib.figure import Figure > from mpl_toolkits.mplot3d import Axes3D > > ....(Continue reading)
12 Jun 2012 00:34
Re: matplotlib 3d scatter plot in Traits
On Tue, Jun 12, 2012 at 3:58 AM, Brennan Williams <brennan.williams@...> wrote: > Got the zoom working. I was overwriting my 'figure' which led to the > zoom/rotate controls not working. > > I just need to work out how to colour code my circles on my scatter plot > now. They are all one colour. But that is a matplotlib question, not a > Traits one. > > Thanks to Gael for his work on this. > > Brennan > > On 11/06/2012 10:51 p.m., Brennan Williams wrote: >> On 11/06/2012 10:16 p.m., Jaidev Deshpande wrote: >>> Hi, >>> >>>> I get a 3D scatter plot but I don't have the interactive zoom/pan >>>> controls working but I suppose that is hardly surprising as they are >>>> matplotlib GUI interactions rather than Traits GUI interactions. >>> It is indeed possible to get the matplotlib zoom and pan operations >>> into the dialog. Out of curiosity, which part of the MPLFigureEditor >>> did you use? >> My code..... >> >> >> import matplotlib.pyplot as mplplt >> from mpl_figure_editor import MPLFigureEditor >> from matplotlib.figure import Figure >> from mpl_toolkits.mplot3d import Axes3D(Continue reading)
12 Jun 2012 02:30
Re: matplotlib 3d scatter plot in Traits
On Mon, Jun 11, 2012 at 11:28:50PM +0100, Brennan Williams wrote: > Thanks to Gael for his work on this. Scanning my mail quickly, I just saw that (one is primed to his name :$). Thanks for you thanks :). It's a pleasure to see that this code is still available. G
12 Jun 2012 11:44
Re: matplotlib 3d scatter plot in Traits
Just another question about how Traits wraps around matplotlib...
I use a Treeeditor so quite often my application comes out of one view
to display another in the rhs pane.
I'm using...
from matplotlib.figure import Figure
from mpl_toolkits.mplot3d import Axes3D
and in my RZThing class definition I have...
figure=Instance(Figure)
axes3d=Instance(Axes3D)
and then in my class method to create the plot I go
self.figure=mplplt.figure()
self.axes3d = self.figure.add_subplot(111, projection='3d')
This works ok the first time.
But if I go to another RZThing object in my tree (which creates a view
for that instance of RZThing) and then come back to my original RZThing
I get error messages such as....
File "c:\program files\rezen27\rz_traits.py", line ..., in rebuildPlot2a
self.axes3d = self.figure.add_subplot(111, projection='3d')
File "c:\python27\lib\site-packages\matplotlib\figure.py", line 777,
in add_subplot
(Continue reading)
19 Jun 2012 11:30
Re: matplotlib 3d scatter plot in Traits
When I embed a matplotlib 3D scatter plot in my Traits app I can rotate, zoom etc but I don't get the x,y,z positional info down below the plot (and below the matplotlib buttons). You do get that when running a standalone matplotlib script. But in Traits that part of the window/plot is not displayed. Anyone have an idea whether this is a Traits or a matplotlib issue? Brennan On 12/06/2012 10:44 a.m., Brennan Williams wrote: > Just another question about how Traits wraps around matplotlib... > > I use a Treeeditor so quite often my application comes out of one view > to display another in the rhs pane. > > I'm using... > > from matplotlib.figure import Figure > from mpl_toolkits.mplot3d import Axes3D > > and in my RZThing class definition I have... > > figure=Instance(Figure) > axes3d=Instance(Axes3D) > > and then in my class method to create the plot I go > > self.figure=mplplt.figure() > self.axes3d = self.figure.add_subplot(111, projection='3d') >(Continue reading)
19 Jun 2012 13:11
Re: matplotlib 3d scatter plot in Traits
On Tue, Jun 19, 2012 at 10:30 AM, Brennan Williams <brennan.williams@...> wrote: > When I embed a matplotlib 3D scatter plot in my Traits app I can rotate, > zoom etc but I don't get the x,y,z positional info down below the plot > (and below the matplotlib buttons). > You do get that when running a standalone matplotlib script. But in > Traits that part of the window/plot is not displayed. Anyone have an > idea whether this is a Traits or a matplotlib issue? The x,y,z positional information is in a status bar. Status bars are part of the decoration of full-blown windows, not embedded widgets. When you embed a matplotlib plot inside of a Traits UI, you are just embedding the plain plot widget. If you know how to get this information out of the matplotlib plot widget, then you can push it into a Traits UI StatusBar: https://github.com/enthought/traitsui/blob/master/examples/demo/Advanced/Statusbar_demo.py Or just a "readonly" Item on a Str trait, if you want to put it somewhere else in the UI. I'm afraid that I don't know how to get this information out of the matplotlib plot widget. You will have to consult its documentation, source, or mailing list. -- -- Robert Kern Enthought
19 Jun 2012 13:29
Re: matplotlib 3d scatter plot in Traits
On 19/06/2012 12:11 p.m., Robert Kern wrote: > On Tue, Jun 19, 2012 at 10:30 AM, Brennan Williams > <brennan.williams@...> wrote: >> When I embed a matplotlib 3D scatter plot in my Traits app I can rotate, >> zoom etc but I don't get the x,y,z positional info down below the plot >> (and below the matplotlib buttons). >> You do get that when running a standalone matplotlib script. But in >> Traits that part of the window/plot is not displayed. Anyone have an >> idea whether this is a Traits or a matplotlib issue? > The x,y,z positional information is in a status bar. Status bars are > part of the decoration of full-blown windows, not embedded widgets. > When you embed a matplotlib plot inside of a Traits UI, you are just > embedding the plain plot widget. If you know how to get this > information out of the matplotlib plot widget, then you can push it > into a Traits UI StatusBar: > > https://github.com/enthought/traitsui/blob/master/examples/demo/Advanced/Statusbar_demo.py > > Or just a "readonly" Item on a Str trait, if you want to put it > somewhere else in the UI. > > I'm afraid that I don't know how to get this information out of the > matplotlib plot widget. You will have to consult its documentation, > source, or mailing list. > OK, I thought that was probably the case. I'll keep looking in the matplotlib documentation. Thanks for the confirmation.(Continue reading)
RSS Feed