Re: [Matplotlib-users] Axes3d.mouse_init(), facing problems when embedding matplotlib 3d-projection into PyQt5 App

2015-04-30 Thread Christian Ambros
 I just managed to read Thomas post on stackoverflow citation. Yes, it covers, 
exactly what I found. This would have help if I would have found earlier.
@Ben:As I said, it's nice to see such implementation but it's offside the task 
and offside the suggested components to use. It doesn't cover the issues I had 
to deal with. I am not disregarding it! But if you have to use a gui built with 
Qt Designer to decouple gui design which might be given as task to someone else 
so you can focus on implementing the functional parts, and somewhat later, 
someone shall improve the design, this way of creating things has the advantage 
that proceeding the work, if one stops working for the project, is as easy as 
it should be.You can split the work to gain more development speed, which is an 
advantage, too. Keeping the functional part away from the gui itself, enables 
one to improve the design without touching the functional code and without 
changing it's revision number if version control systems are used. Code 
recycling is a third one. I don't see any drawback, yet, if you don't take into 
account that they may be something missing in the additional libraries and the 
gab might cause problems not solvable.But that's not the topic of this thread.
Yes, Qt Designer just provides only the framework, which than can be filled 
with content, for example, coming from matplotlib. Having just a dummy widget 
to fill as interface pays respect to being most flexible.
No, having to re-initiate the mouse because it is disabled from matplotlib due 
to an empty canvas is not wrong but a design decision. One could have easily 
decided to not disable it, but the ones who wrote that part might have thought, 
that if the canvas is empty,you don't need axes to rotate. They discovered that 
this thoughts lead to problems and build a workaround enabling to switch it on 
again, rather than change the default. That's ok for me, because it was there 
decision. I would have like to find any hint about that in books, tutorials or 
stuff like that, but that seems to be a not that often regarded problem.
I took your objection about adding the axis before the canvas is build and 
changed the code so after creating the figure I'm adding it to the canvas so it 
won't be empty anymore. This is a better way and is avoiding the mouse 
issue.Yes, it's clear now, but that is what I asked for in the first place. I 
mentioned that there may be something out of correct order. Now we know what it 
was and I fixed it.
I like this kind of discussion which clarify the understanding, because you can 
get them from books. So thank you very much for the talk.
I think I'm going to review the part where all the figures are created and will 
put them into a method which builds them if needed. That would clean up the 
design and the code, too.But that's something for after the deadline, for which 
the code can be as ugly as it is. It just has to work to get my job contract 
renewed.
cheers,Christian

--
A little learning never caused anyone's head to explode!

Ein wenig Lernen hat noch niemandens Kopf zum Explodieren gebracht! 






   



  --
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Axes3d.mouse_init(), facing problems when embedding matplotlib 3d-projection into PyQt5 App

2015-04-29 Thread Christian Ambros
Ok, back from revision...
The is no mix-up for the show command. The only explicit show() command is 
commented out in line 41. It can be deleted. But I haven't done that, yet. 
There are several bits of code which are remains of the design process since 
this is work in progress. Code cleaning will be done when the main 
functionality is in place.
Back to addmpl where I embedded gui elements into the canvas. Taking out the 
matplotlib taskbar doesn't change a thing as I wrote earlier, but to make sure 
it doesn't bother the mainloop, it should be commented out. I may not put it 
back in, because I don't see the point in needing it. It was just to see if 
it's possible.
But option 2 relinquishes that control to the developer's GUI app. You 
*cannot* use pyplot for option 2, which is what you are doing. 

Is that so? In line 116 I create the canvas, which is derived from matplotlib's 
backend's FigureCanvasQTAgg and given to the QWidget at line 119. That's the 
only part where both interact with each other. the rest is handle by 
matplotlib. 

The error message says that Axes3D.figure.canvas is 'None' and that's why mouse 
rotation is disabled.It's None because there is no content at that point, when 
it's passed to the QWidget. It's filled with content in line 38. So if 
matplotlib disables the mouse rotation by default, when the canvas is empty how 
do I prevent this disabling by default? 
If I can't, at what point do I have to pass the filled canvas to the QWidget? 
How does that impact the GUI itself? 
If I can't enable the mouse rotation by hand and I just can pass filled canvas 
around, do I have to build a work around with initialize it with an empty 2D 
canvas and replace it later with the filled 3D canvas? How's the mouse rotation 
activated then?

In general, I wouldn't have to enable the rotation if it wouldn't be switch off 
for an empty canvas.
I'm going to consult your book, now, for different ways of coping with such 
things...
cheers,Christian --
A little learning never caused anyone's head to explode!

Ein wenig Lernen hat noch niemandens Kopf zum Explodieren gebracht! 


 On Tuesday, April 28, 2015 8:28 PM, Benjamin Root ben.r...@ou.edu wrote:
   

 One thing I see off the bat is your addmpl() method:

```
    def addmpl(self, fig):
    #FigureCanvas.__init__(self, fig)
    self.canvas = FigureCanvas(fig)
    
    Axes3D.mouse_init(self, rotate_btn=1, zoom_btn=2)
    self.mplvl.addWidget(self.canvas)
    self.canvas.draw()
    self.toolbar = NavigationToolbar(self.canvas, self.mplwindow, 
coordinates=True)
    self.mplvl.addWidget(self.toolbar)
```

You are calling Axes3D.mouse_init() on the Main object (that is `self`). That 
is completely wrong. It can only be called for the 3d axes objects.

Also, what I see happening here is some mixing up of how to do embedding. There 
are two approaches to embedding. 1) you can embedded GUI elements into your 
canvas widget, or 2) you can embed your canvas widget into your GUI app. The 
important distinction between the two is who controls the mainloop. In option 1 
(and in matplotlib in general), pyplot will create the GUI app for you 
automatically (it is completely transparent to you) and kicks it off upon call 
to show(). But option 2 relinquishes that control to the developer's GUI app. 
You *cannot* use pyplot for option 2, which is what you are doing. Rip out all 
of the pyplot stuff, and instantiate the Qt5 Figure object directly, and then 
obtain the axes objects from the figure object via calls to add_subplot(). You 
shouldn't even need to do the whole mouse_init() stuff.

I now think this has nothing to do with Qt Designer. While I don't specifically 
cover qt5 in my book, I do make all of these distinctions very clear in chapter 
5 of my book Interactive Applications using Matplotlib.

Cheers!
Ben Root


On Tue, Apr 28, 2015 at 4:03 PM, Christian Ambros ambr...@ymail.com wrote:

Hi Benjamin,
I would do that if my task were my private stuff, but in this case it's 
work-related and my boss wants me to use the designer and he already set a 
deadline, which, I already knew, is set to tight. I told him before, that it 
would be just a try but he sold it to his boss after some pressure. You know 
how the bosses' bosses are, they don't get the idea that innovation can't be 
dictated. They don't understand the concept that software is written and 
doesn't come into existence out of nothing.
Without PyQt5 it's working fine. I got the plots and they are gorgeous, but 
that doesn't help when presenting to the bosses. If I just would know how to 
activate the 3d-draw's mouse action again, by hand, than it has to last just 
some moments for the presentation, afterwards I have the time to examine and 
find a more robust solution.
Thanks for the effort.cheers,Christian
 --
A little learning never caused anyone's head to explode!

Ein wenig Lernen hat noch niemandens Kopf zum Explodieren gebracht! 


 On Tuesday

Re: [Matplotlib-users] Axes3d.mouse_init(), facing problems when embedding matplotlib 3d-projection into PyQt5 App

2015-04-28 Thread Christian Ambros
Hi Benjamin,
I would do that if my task were my private stuff, but in this case it's 
work-related and my boss wants me to use the designer and he already set a 
deadline, which, I already knew, is set to tight. I told him before, that it 
would be just a try but he sold it to his boss after some pressure. You know 
how the bosses' bosses are, they don't get the idea that innovation can't be 
dictated. They don't understand the concept that software is written and 
doesn't come into existence out of nothing.
Without PyQt5 it's working fine. I got the plots and they are gorgeous, but 
that doesn't help when presenting to the bosses. If I just would know how to 
activate the 3d-draw's mouse action again, by hand, than it has to last just 
some moments for the presentation, afterwards I have the time to examine and 
find a more robust solution.
Thanks for the effort.cheers,Christian
 --
A little learning never caused anyone's head to explode!

Ein wenig Lernen hat noch niemandens Kopf zum Explodieren gebracht! 


 On Tuesday, April 28, 2015 7:30 PM, Benjamin Root ben.r...@ou.edu wrote:
   

 I think there is something wrong with the embedding code rather than there 
being an actual bug. I have embedded mplot3d stuff before (admittedly, not in 
qt5) with no problems. I haven't had the time yet to examine your code to see 
what the potential issue is, though. I have also never used Qt designer, so I 
have no clue if there is something that it is doing that might be making things 
difficult.

I already know that the code you originally posted has errors in it. I would 
suggest first making a prototype without Qt Designer as a proof-of-concept, 
perhaps starting with one of our examples in the gallery?

Ben Root


On Tue, Apr 28, 2015 at 2:12 PM, Christian Ambros ambr...@ymail.com wrote:

 Since there seems to be no progress with this issue, may I assume there isn't 
any interest in it?I took a further look around in the internet but couldn't 
any solution.It leads to an other question: How many users of matplotlib are 
using 3d-plots anyway? It we are just a few and there won't be anyone who wants 
to embed it in PyQt5, than I can understand that this issue doesn't concern 
no-one and I have to look somewhere else to find a 3d-plotting lib which is 
embedable.
cheers,Christain
--
A little learning never caused anyone's head to explode!

Ein wenig Lernen hat noch niemandens Kopf zum Explodieren gebracht! 


 On Tuesday, April 21, 2015 1:44 PM, Benjamin Root ben.r...@ou.edu wrote:
   

 The addmpl() method isn't right. You created a canvas object, assigned it to 
self.canvas, but then tried to call FigureCanvas.__init__(), passing it 
whatever object self is. What class is addmpl() a part of? What does it 
subclass?

On Tue, Apr 21, 2015 at 7:24 AM, Christian Ambros ambr...@ymail.com wrote:

Hi,
I embedded Ryan's examble for PyQt5-matplotlib use into my App but I get the 
following error:
/usr/local/lib/python3.4/dist-packages/mpl_toolkits/mplot3d/axes3d.py:1009: 
UserWarning: Axes3D.figure.canvas is 'None', mouse rotation disabled.  Set 
canvas then call Axes3D.mouse_init().
  warnings.warn('Axes3D.figure.canvas is \'None\', mouse rotation disabled.  
Set canvas then call Axes3D.mouse_init().')

From Stackoverflow, which host to question about this, I know that mouse 
actions are disabled when the canvas is re-initialized by whatever.
The only position I do such an operation is in here:    def addmpl(self, fig):
    self.canvas = FigureCanvas(fig)
    #FigureCanvas.__init__(self, fig)
    #Axes3D.mouse_init(self)
    self.mplvl.addWidget(self.canvas)
    self.canvas.draw()
    self.toolbar = NavigationToolbar(self.canvas, self.mplwindow, 
coordinates=True)
    self.mplvl.addWidget(self.toolbar)
 On of the Stackoverflow suggestion says, that re initializing FigureCanvas 
should do the trick but I'll get: 

Traceback (most recent call last):
  File ./ex_0.1.py, line 145, in module
    main(sys.argv)
  File ./ex_0.1.py, line 53, in main
    mainwindow.addmpl(fig1)
  File ./ex_0.1.py, line 116, in addmpl
    FigureCanvas.__init__(self, fig)
  File 
/usr/local/lib/python3.4/dist-packages/matplotlib/backends/backend_qt5agg.py, 
line 181, in __init__
    FigureCanvasQT.__init__(self, figure)
  File 
/usr/local/lib/python3.4/dist-packages/matplotlib/backends/backend_qt5.py, 
line 237, in __init__
    super(FigureCanvasQT, self).__init__(figure=figure)
TypeError: super(type, obj): obj must be an instance or subtype of type

as follow-up error message.
just using Axes3D.mouse_init() , as suggested by matplotlib itself, leads to:
Traceback (most recent call last):
  File ./ex_0.1.py, line 146, in module
    main(sys.argv)
  File ./ex_0.1.py, line 53, in main
    mainwindow.addmpl(fig1)
  File ./ex_0.1.py, line 118, in addmpl
    Axes3D.mouse_init()
TypeError: mouse_init() missing 1 required positional argument: 'self'
adding self leads to:
Traceback (most recent call last):
  File

Re: [Matplotlib-users] Axes3d.mouse_init(), facing problems when embedding matplotlib 3d-projection into PyQt5 App

2015-04-28 Thread Christian Ambros
 Since there seems to be no progress with this issue, may I assume there isn't 
any interest in it?I took a further look around in the internet but couldn't 
any solution.It leads to an other question: How many users of matplotlib are 
using 3d-plots anyway? It we are just a few and there won't be anyone who wants 
to embed it in PyQt5, than I can understand that this issue doesn't concern 
no-one and I have to look somewhere else to find a 3d-plotting lib which is 
embedable.
cheers,Christain
--
A little learning never caused anyone's head to explode!

Ein wenig Lernen hat noch niemandens Kopf zum Explodieren gebracht! 


 On Tuesday, April 21, 2015 1:44 PM, Benjamin Root ben.r...@ou.edu wrote:
   

 The addmpl() method isn't right. You created a canvas object, assigned it to 
self.canvas, but then tried to call FigureCanvas.__init__(), passing it 
whatever object self is. What class is addmpl() a part of? What does it 
subclass?

On Tue, Apr 21, 2015 at 7:24 AM, Christian Ambros ambr...@ymail.com wrote:

Hi,
I embedded Ryan's examble for PyQt5-matplotlib use into my App but I get the 
following error:
/usr/local/lib/python3.4/dist-packages/mpl_toolkits/mplot3d/axes3d.py:1009: 
UserWarning: Axes3D.figure.canvas is 'None', mouse rotation disabled.  Set 
canvas then call Axes3D.mouse_init().
  warnings.warn('Axes3D.figure.canvas is \'None\', mouse rotation disabled.  
Set canvas then call Axes3D.mouse_init().')

From Stackoverflow, which host to question about this, I know that mouse 
actions are disabled when the canvas is re-initialized by whatever.
The only position I do such an operation is in here:    def addmpl(self, fig):
    self.canvas = FigureCanvas(fig)
    #FigureCanvas.__init__(self, fig)
    #Axes3D.mouse_init(self)
    self.mplvl.addWidget(self.canvas)
    self.canvas.draw()
    self.toolbar = NavigationToolbar(self.canvas, self.mplwindow, 
coordinates=True)
    self.mplvl.addWidget(self.toolbar)
 On of the Stackoverflow suggestion says, that re initializing FigureCanvas 
should do the trick but I'll get: 

Traceback (most recent call last):
  File ./ex_0.1.py, line 145, in module
    main(sys.argv)
  File ./ex_0.1.py, line 53, in main
    mainwindow.addmpl(fig1)
  File ./ex_0.1.py, line 116, in addmpl
    FigureCanvas.__init__(self, fig)
  File 
/usr/local/lib/python3.4/dist-packages/matplotlib/backends/backend_qt5agg.py, 
line 181, in __init__
    FigureCanvasQT.__init__(self, figure)
  File 
/usr/local/lib/python3.4/dist-packages/matplotlib/backends/backend_qt5.py, 
line 237, in __init__
    super(FigureCanvasQT, self).__init__(figure=figure)
TypeError: super(type, obj): obj must be an instance or subtype of type

as follow-up error message.
just using Axes3D.mouse_init() , as suggested by matplotlib itself, leads to:
Traceback (most recent call last):
  File ./ex_0.1.py, line 146, in module
    main(sys.argv)
  File ./ex_0.1.py, line 53, in main
    mainwindow.addmpl(fig1)
  File ./ex_0.1.py, line 118, in addmpl
    Axes3D.mouse_init()
TypeError: mouse_init() missing 1 required positional argument: 'self'
adding self leads to:
Traceback (most recent call last):
  File ./ex_0.1.py, line 146, in module
    main(sys.argv)
  File ./ex_0.1.py, line 53, in main
    mainwindow.addmpl(fig1)
  File ./ex_0.1.py, line 118, in addmpl
    Axes3D.mouse_init(self)
  File /usr/local/lib/python3.4/dist-packages/mpl_toolkits/mplot3d/axes3d.py, 
line 1002, in mouse_init
    canv = self.figure.canvas
AttributeError: 'Main' object has no attribute 'figure'
./ex_0.1.py 

Maybe I'm adding those lines at the wrong place, but I could fined anything 
useful in the matplotlib documantation, that would help me out, either.
Any thougts that might help?
Cheers,Christian

--
A little learning never caused anyone's head to explode!

Ein wenig Lernen hat noch niemandens Kopf zum Explodieren gebracht!
--
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15utm_medium=emailutm_campaign=VA_SF
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users





  --
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y___
Matplotlib-users mailing list
Matplotlib

[Matplotlib-users] Axes3d.mouse_init(), facing problems when embedding matplotlib 3d-projection into PyQt5 App

2015-04-21 Thread Christian Ambros
Hi,
I embedded Ryan's examble for PyQt5-matplotlib use into my App but I get the 
following error:
/usr/local/lib/python3.4/dist-packages/mpl_toolkits/mplot3d/axes3d.py:1009: 
UserWarning: Axes3D.figure.canvas is 'None', mouse rotation disabled.  Set 
canvas then call Axes3D.mouse_init().
  warnings.warn('Axes3D.figure.canvas is \'None\', mouse rotation disabled.  
Set canvas then call Axes3D.mouse_init().')

From Stackoverflow, which host to question about this, I know that mouse 
actions are disabled when the canvas is re-initialized by whatever.
The only position I do such an operation is in here:    def addmpl(self, fig):
    self.canvas = FigureCanvas(fig)
    #FigureCanvas.__init__(self, fig)
    #Axes3D.mouse_init(self)
    self.mplvl.addWidget(self.canvas)
    self.canvas.draw()
    self.toolbar = NavigationToolbar(self.canvas, self.mplwindow, 
coordinates=True)
    self.mplvl.addWidget(self.toolbar)
 On of the Stackoverflow suggestion says, that re initializing FigureCanvas 
should do the trick but I'll get: 

Traceback (most recent call last):
  File ./ex_0.1.py, line 145, in module
    main(sys.argv)
  File ./ex_0.1.py, line 53, in main
    mainwindow.addmpl(fig1)
  File ./ex_0.1.py, line 116, in addmpl
    FigureCanvas.__init__(self, fig)
  File 
/usr/local/lib/python3.4/dist-packages/matplotlib/backends/backend_qt5agg.py, 
line 181, in __init__
    FigureCanvasQT.__init__(self, figure)
  File 
/usr/local/lib/python3.4/dist-packages/matplotlib/backends/backend_qt5.py, 
line 237, in __init__
    super(FigureCanvasQT, self).__init__(figure=figure)
TypeError: super(type, obj): obj must be an instance or subtype of type

as follow-up error message.
just using Axes3D.mouse_init() , as suggested by matplotlib itself, leads to:
Traceback (most recent call last):
  File ./ex_0.1.py, line 146, in module
    main(sys.argv)
  File ./ex_0.1.py, line 53, in main
    mainwindow.addmpl(fig1)
  File ./ex_0.1.py, line 118, in addmpl
    Axes3D.mouse_init()
TypeError: mouse_init() missing 1 required positional argument: 'self'
adding self leads to:
Traceback (most recent call last):
  File ./ex_0.1.py, line 146, in module
    main(sys.argv)
  File ./ex_0.1.py, line 53, in main
    mainwindow.addmpl(fig1)
  File ./ex_0.1.py, line 118, in addmpl
    Axes3D.mouse_init(self)
  File /usr/local/lib/python3.4/dist-packages/mpl_toolkits/mplot3d/axes3d.py, 
line 1002, in mouse_init
    canv = self.figure.canvas
AttributeError: 'Main' object has no attribute 'figure'
./ex_0.1.py 

Maybe I'm adding those lines at the wrong place, but I could fined anything 
useful in the matplotlib documantation, that would help me out, either.
Any thougts that might help?
Cheers,Christian

--
A little learning never caused anyone's head to explode!

Ein wenig Lernen hat noch niemandens Kopf zum Explodieren gebracht!--
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15utm_medium=emailutm_campaign=VA_SF___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Qt4 Designer Example

2015-04-14 Thread Christian Ambros
Hi Ryan,
wow! This tutorial is one of the best I ever encountered. Nothing is missing, 
nothing is cryptic or unclear. What I like best is, that it get's along without 
using Qt Designer plugins or something similar strange. It's a good basis to 
start. Maybe you should write a book, covering all the untold things one needs 
to solve problems like that. I browsed through plenty of books the last weeks 
and what really is missing, is a cookbook about Qt Designer, Glade and 
wxWidgets and how to fill it with python3 and it's lib's like matplotlib, 
pyqtgraph, numpy, sympy etc.
I would buy it right away!cheers,Christian
 --
A little learning never caused anyone's head to explode!

Ein wenig Lernen hat noch niemandens Kopf zum Explodieren gebracht! 


 On Friday, April 10, 2015 7:14 PM, Ryan Nelson rnelsonc...@gmail.com 
wrote:
   

 Christian,
As it turns out, I wrote a blog post (for my terrible blog) about using 
Designer to create a MPL based GUI 
(http://blog.rcnelson.com/building-a-matplotlib-gui-with-qt-designer-part-1/). 
I was going to write this up for the MPL docs... But it got really long (3 
parts), so I just used my personal site. It got so long because this was the 
second time I needed to figure this out, and I wanted to make a very detailed 
outline for my own future reference. Unfortunately, I don't have any experience 
with Qt5, but I imagine things are similar. I think they just rearranged the 
locations of some of the widgets, but I'd be curious to hear your experience. I 
gave up on PyQtdesignerplugins. I think it makes more sense to just use a 
generic widget as the MPL container. 
I would be very happy if you had comments for my Qt designer posts.
Ryan
On Wed, Apr 8, 2015 at 5:47 AM, Christian Ambros ambr...@ymail.com wrote:

Hi Ryan,
could you write down, as a tutorial, how you built the example with the qt 
designer?In the last hours I read all most everything what can be found on the 
issue of getting matplotlib running with pyqt5 and the designer but as you 
realized yourself, there is little to be found handy.
I'm stuck at a project, which has to use python3, and pyqt5 and am not allowed 
by my boss to fall back to pyqt4 or qt_compat. He wants to make sure that we 
use the latest revisions.
So I#m very pleased to read that someone already set food on this terrain. 
Qt5.4.1 is running and I installed PyQtdesingerplugins, in mind that they were 
written for PyQt4. Are they usable in 5? I added the env-variables to my 
bashrc, did get any changes shown in the designer. Of course I did a re-log-in 
to start fresh, but any changes were noteable.What possible ways of embedding 
matplotlib into a designer base pyqt5-gui else, are there?
cheers,Christian


 --
A little learning never caused anyone's head to explode!

Ein wenig Lernen hat noch niemandens Kopf zum Explodieren gebracht! 


 On Wednesday, February 18, 2015 11:59 PM, Ryan Nelson 
rnelsonc...@gmail.com wrote:
   

 Hello list,
A couple months ago, I spent quite a bit of time trying to figure out how to 
use Qt designer create a GUI with an embedded MPL window. Unfortunately, the 
Scipy cookbook page 
(http://wiki.scipy.org/Cookbook/Matplotlib/Qt_with_IPython_and_Designer) is 
very outdated. A recent post 
(http://matplotlib.1069221.n5.nabble.com/Re-Keep-list-of-figures-or-plots-and-flip-through-list-using-UI-td44961.html)
 brought up some questions about a use case very similar to mine, so I redid my 
example and was going to write a quick tutorial for the docs.
Unfortunately, I'm not a Qt guru, so I thought that I would ask on the list for 
some advice.  The OP and I were both interested in being able to have a list of 
figures that you could select from to change the plot window. The embedding 
examples in the docs create subclasses of FigureClass* and embed the plotting 
figure/axes/etc. This works but gets tricky, though, when trying to switch 
plots. Also, for interactive IPython work, I didn't like that the plotting 
objects were mixed in with all the QtGui.QWidget attributes, which makes 
introspective searching painful. My solution was to create a dictionary of 
matplotlib.figure.Figure objects that had all of the plotting stuff defined. 
Then when I select a new plot from the list, the old one is removed and a new 
FigureClass object is created using the selected Figure object. Has anyone else 
successfully done something like this? Is there a better way? Also, it seems if 
I zoom the current plot, change to a new plot, and change back, the zoom region 
is retained. Anyone know how to reset the zoom region?
Attached is my example: window.py is the Designer-created main window and 
custommpl.py is the subclass of the main window that I wrote. It's about as 
short as I could make it.

Thanks
Ryan


--
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards

Re: [Matplotlib-users] Qt4 Designer Example

2015-04-08 Thread Christian Ambros
Hi Ryan,
could you write down, as a tutorial, how you built the example with the qt 
designer?In the last hours I read all most everything what can be found on the 
issue of getting matplotlib running with pyqt5 and the designer but as you 
realized yourself, there is little to be found handy.
I'm stuck at a project, which has to use python3, and pyqt5 and am not allowed 
by my boss to fall back to pyqt4 or qt_compat. He wants to make sure that we 
use the latest revisions.
So I#m very pleased to read that someone already set food on this terrain. 
Qt5.4.1 is running and I installed PyQtdesingerplugins, in mind that they were 
written for PyQt4. Are they usable in 5? I added the env-variables to my 
bashrc, did get any changes shown in the designer. Of course I did a re-log-in 
to start fresh, but any changes were noteable.What possible ways of embedding 
matplotlib into a designer base pyqt5-gui else, are there?
cheers,Christian


 --
A little learning never caused anyone's head to explode!

Ein wenig Lernen hat noch niemandens Kopf zum Explodieren gebracht! 


 On Wednesday, February 18, 2015 11:59 PM, Ryan Nelson 
rnelsonc...@gmail.com wrote:
   

 Hello list,
A couple months ago, I spent quite a bit of time trying to figure out how to 
use Qt designer create a GUI with an embedded MPL window. Unfortunately, the 
Scipy cookbook page 
(http://wiki.scipy.org/Cookbook/Matplotlib/Qt_with_IPython_and_Designer) is 
very outdated. A recent post 
(http://matplotlib.1069221.n5.nabble.com/Re-Keep-list-of-figures-or-plots-and-flip-through-list-using-UI-td44961.html)
 brought up some questions about a use case very similar to mine, so I redid my 
example and was going to write a quick tutorial for the docs.
Unfortunately, I'm not a Qt guru, so I thought that I would ask on the list for 
some advice.  The OP and I were both interested in being able to have a list of 
figures that you could select from to change the plot window. The embedding 
examples in the docs create subclasses of FigureClass* and embed the plotting 
figure/axes/etc. This works but gets tricky, though, when trying to switch 
plots. Also, for interactive IPython work, I didn't like that the plotting 
objects were mixed in with all the QtGui.QWidget attributes, which makes 
introspective searching painful. My solution was to create a dictionary of 
matplotlib.figure.Figure objects that had all of the plotting stuff defined. 
Then when I select a new plot from the list, the old one is removed and a new 
FigureClass object is created using the selected Figure object. Has anyone else 
successfully done something like this? Is there a better way? Also, it seems if 
I zoom the current plot, change to a new plot, and change back, the zoom region 
is retained. Anyone know how to reset the zoom region?
Attached is my example: window.py is the Designer-created main window and 
custommpl.py is the subclass of the main window that I wrote. It's about as 
short as I could make it.

Thanks
Ryan


--
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration  more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=190641631iu=/4140/ostg.clktrk
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


  --
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15utm_medium=emailutm_campaign=VA_SF___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] [matplotlib-devel] 1.4.3 does not build on Ubuntu 14 with python3

2015-04-01 Thread Christian Ambros
Hi,
I'm facing the same trouble with installing matplotlib 1.4.3 and 1.5.dev1. 
running 

    python3 setup.py build 

in the unarchived directory gives this:

Edit setup.cfg to change the build options

BUILDING MATPLOTLIB
    matplotlib: yes [1.5.dev1]
    python: yes [3.4.0 (default, Apr 11 2014, 13:05:11)  [GCC
    4.8.2]]
  platform: yes [linux]

REQUIRED DEPENDENCIES AND EXTENSIONS
 numpy: yes [version 1.9.2]
   six: yes [using six version 1.5.2]
  dateutil: yes [using dateutil version 2.0]
  pytz: yes [using pytz version 2012c]
   tornado: yes [using tornado version 3.1.1]
 pyparsing: yes [using pyparsing version 2.0.1]
    libagg: yes [Requires patches that have not been merged
    upstream. Using local copy.]
Traceback (most recent call last):
  File setup.py, line 153, in module
    result = package.check()
  File /home/ambrosc/Downloads/matplotlib-master/setupext.py, line 900, in 
check
    min_version='2.3', version=version)
  File /home/ambrosc/Downloads/matplotlib-master/setupext.py, line 446, in 
_check_for_pkg_config
    if (not is_min_version(version, min_version)):
  File /home/ambrosc/Downloads/matplotlib-master/setupext.py, line 173, in 
is_min_version
    return found_version = expected_version
  File /usr/lib/python3.4/distutils/version.py, line 76, in __ge__
    c = self._cmp(other)
  File /usr/lib/python3.4/distutils/version.py, line 343, in _cmp
    if self.version  other.version:
TypeError: unorderable types: str()  int()

I'm running Linux Mint 17 Quina which is based on Ubuntu's trusty packges.
pip3 is up to date. Running     
    print(setuptools.__file__)
gives: /usr/local/lib/python3.4/dist-packages/setuptools/__init__.py which is 
as expected.
Using pip3 install matplotlib --upgrade #even to 1.4.3get's me this:

Collecting matplotlib from 
https://pypi.python.org/packages/source/m/matplotlib/matplotlib-1.4.3.tar.gz#md5=86af2e3e3c61849ac7576a6f5ca44267
  Downloading matplotlib-1.4.3.tar.gz (50.4MB)
    100% || 50.4MB 8.0kB/s 
    Traceback (most recent call last):
  File string, line 20, in module
  File /tmp/pip-build-sezmzam8/matplotlib/setup.py, line 155, in module
    result = package.check()
  File /tmp/pip-build-sezmzam8/matplotlib/setupext.py, line 961, in check
    min_version='2.3', version=version)
  File /tmp/pip-build-sezmzam8/matplotlib/setupext.py, line 445, in 
_check_for_pkg_config
    if (not is_min_version(version, min_version)):
  File /tmp/pip-build-sezmzam8/matplotlib/setupext.py, line 173, in 
is_min_version
    return found_version = expected_version
  File /usr/lib/python3.4/distutils/version.py, line 76, in __ge__
    c = self._cmp(other)
  File /usr/lib/python3.4/distutils/version.py, line 343, in _cmp
    if self.version  other.version:
    TypeError: unorderable types: str()  int()
    
    Edit setup.cfg to change the build options
    BUILDING MATPLOTLIB
    matplotlib: yes [1.4.3]
    python: yes [3.4.0 (default, Apr 11 2014, 13:05:11)  [GCC
    4.8.2]]
  platform: yes [linux]
    REQUIRED DEPENDENCIES AND EXTENSIONS
 numpy: yes [version 1.9.2]
   six: yes [using six version 1.5.2]
  dateutil: yes [using dateutil version 2.0]
  pytz: yes [using pytz version 2012c]
   tornado: yes [using tornado version 3.1.1]
 pyparsing: yes [using pyparsing version 2.0.1]
 pycxx: yes [Official versions of PyCXX are not compatible
    with matplotlib on Python 3.x, since they lack
    support for the buffer object.  Using local copy]
    libagg: yes [Requires patches that have not been merged
    upstream. Using local copy.]
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
    
  File string, line 20, in module
    
  File /tmp/pip-build-sezmzam8/matplotlib/setup.py, line 155, in module
    
    result = package.check()
    
  File /tmp/pip-build-sezmzam8/matplotlib/setupext.py, line 961, in check
    
    min_version='2.3', version=version)
    
  File /tmp/pip-build-sezmzam8/matplotlib/setupext.py, line 445, in 
_check_for_pkg_config
    
    if (not is_min_version(version, min_version)):
    
  File /tmp/pip-build-sezmzam8/matplotlib/setupext.py, line 173, in 
is_min_version
    
    return found_version = expected_version
    
  File /usr/lib/python3.4/distutils/version.py, line 76, in __ge__
   

Re: [Matplotlib-users] [matplotlib-devel] 1.4.3 does not build on Ubuntu 14 with python3

2015-04-01 Thread Christian Ambros
Hi,
as you can see: 14.3.1 which is the latest, because before I started upgrading, 
I read about possible issues here and upgraded the setuptools as conclusion.
Python 3.4.0 (default, Apr 11 2014, 13:05:11) 
[GCC 4.8.2] on linux
Type help, copyright, credits or license for more information.
 import setuptools
 print(setuptools.__version__)
14.3.1
 exit() cheers,Christian
--
A little learning never caused anyone's head to explode!

Ein wenig Lernen hat noch niemandens Kopf zum Explodieren gebracht! 


 On Wednesday, April 1, 2015 1:25 PM, Jens Nielsen jenshniel...@gmail.com 
wrote:
   

 I think we have seen this issue before and it seems to be caused by an out of 
date version of setuptools. I tried reproducing it on fresh ubuntu 14.04 
machine but was not able to reproduce the issue. Do you know which version of 
setuptools you are using? 
Jens 
ons. 1. apr. 2015 kl. 14.19 skrev Thomas Caswell tcasw...@gmail.com:

Make sure you have `freetype-dev` installed at the system level. 
Tom
On Wed, Apr 1, 2015 at 8:02 AM Christian Ambros ambr...@ymail.com wrote:

Hi,
I'm facing the same trouble with installing matplotlib 1.4.3 and 1.5.dev1. 
running 

    python3 setup.py build 

in the unarchived directory gives this:

Edit setup.cfg to change the build options

BUILDING MATPLOTLIB
    matplotlib: yes [1.5.dev1]
    python: yes [3.4.0 (default, Apr 11 2014, 13:05:11)  [GCC
    4.8.2]]
  platform: yes [linux]

REQUIRED DEPENDENCIES AND EXTENSIONS
 numpy: yes [version 1.9.2]
   six: yes [using six version 1.5.2]
  dateutil: yes [using dateutil version 2.0]
  pytz: yes [using pytz version 2012c]
   tornado: yes [using tornado version 3.1.1]
 pyparsing: yes [using pyparsing version 2.0.1]
    libagg: yes [Requires patches that have not been merged
    upstream. Using local copy.]
Traceback (most recent call last):
  File setup.py, line 153, in module
    result = package.check()
  File /home/ambrosc/Downloads/matplotlib-master/setupext.py, line 900, in 
check
    min_version='2.3', version=version)
  File /home/ambrosc/Downloads/matplotlib-master/setupext.py, line 446, in 
_check_for_pkg_config
    if (not is_min_version(version, min_version)):
  File /home/ambrosc/Downloads/matplotlib-master/setupext.py, line 173, in 
is_min_version
    return found_version = expected_version
  File /usr/lib/python3.4/distutils/version.py, line 76, in __ge__
    c = self._cmp(other)
  File /usr/lib/python3.4/distutils/version.py, line 343, in _cmp
    if self.version  other.version:
TypeError: unorderable types: str()  int()

I'm running Linux Mint 17 Quina which is based on Ubuntu's trusty packges.
pip3 is up to date. Running     
    print(setuptools.__file__)
gives: /usr/local/lib/python3.4/dist-packages/setuptools/__init__.py which is 
as expected.
Using pip3 install matplotlib --upgrade #even to 1.4.3get's me this:

Collecting matplotlib from 
https://pypi.python.org/packages/source/m/matplotlib/matplotlib-1.4.3.tar.gz#md5=86af2e3e3c61849ac7576a6f5ca44267
  Downloading matplotlib-1.4.3.tar.gz (50.4MB)
    100% || 50.4MB 8.0kB/s 
    Traceback (most recent call last):
  File string, line 20, in module
  File /tmp/pip-build-sezmzam8/matplotlib/setup.py, line 155, in module
    result = package.check()
  File /tmp/pip-build-sezmzam8/matplotlib/setupext.py, line 961, in check
    min_version='2.3', version=version)
  File /tmp/pip-build-sezmzam8/matplotlib/setupext.py, line 445, in 
_check_for_pkg_config
    if (not is_min_version(version, min_version)):
  File /tmp/pip-build-sezmzam8/matplotlib/setupext.py, line 173, in 
is_min_version
    return found_version = expected_version
  File /usr/lib/python3.4/distutils/version.py, line 76, in __ge__
    c = self._cmp(other)
  File /usr/lib/python3.4/distutils/version.py, line 343, in _cmp
    if self.version  other.version:
    TypeError: unorderable types: str()  int()
    
    Edit setup.cfg to change the build options
    BUILDING MATPLOTLIB
    matplotlib: yes [1.4.3]
    python: yes [3.4.0 (default, Apr 11 2014, 13:05:11)  [GCC
    4.8.2]]
  platform: yes [linux]
    REQUIRED DEPENDENCIES AND EXTENSIONS
 numpy: yes [version 1.9.2]
   six: yes [using six version 1.5.2]
  dateutil: yes [using dateutil version 2.0]
  pytz: yes [using pytz version 2012c]
   tornado: yes [using tornado version 3.1.1]
 pyparsing: yes [using pyparsing version 2.0.1]
 pycxx: yes [Official versions of PyCXX

Re: [Matplotlib-users] [matplotlib-devel] 1.4.3 does not build on Ubuntu 14 with python3

2015-04-01 Thread Christian Ambros
Hi, 

I installed the libfreetype6-dev package and than re-started the upgrade 
process with sudo pip3 install matplotlib --upgrade, which took a while but 
finally was successful.It seems to be all right now.

Thanks for the hint with freetype. That helped a lot.
cheers, 
Christian --
A little learning never caused anyone's head to explode!

Ein wenig Lernen hat noch niemandens Kopf zum Explodieren gebracht! 


 On Wednesday, April 1, 2015 4:52 PM, Benjamin Root ben.r...@ou.edu wrote:
   

 Yeah, that mirrors what others have stated. The common thread seems to be that 
all of these users were comfortable with doing sudo pip install somepkg 
(myself included). I was in a rush when I originally encountered issues back in 
the summer on my 12.04 machine, so I just switched to miniconda and didn't 
figure out what was wrong on my system.



On Wed, Apr 1, 2015 at 12:27 PM, Christian Ambros ambr...@ymail.com wrote:

Hi,
as you can see: 14.3.1 which is the latest, because before I started upgrading, 
I read about possible issues here and upgraded the setuptools as conclusion.
Python 3.4.0 (default, Apr 11 2014, 13:05:11) 
[GCC 4.8.2] on linux
Type help, copyright, credits or license for more information.
 import setuptools
 print(setuptools.__version__)
14.3.1
 exit() cheers,Christian
--
A little learning never caused anyone's head to explode!

Ein wenig Lernen hat noch niemandens Kopf zum Explodieren gebracht! 


 On Wednesday, April 1, 2015 1:25 PM, Jens Nielsen jenshniel...@gmail.com 
wrote:
   

 I think we have seen this issue before and it seems to be caused by an out of 
date version of setuptools. I tried reproducing it on fresh ubuntu 14.04 
machine but was not able to reproduce the issue. Do you know which version of 
setuptools you are using? 
Jens 
ons. 1. apr. 2015 kl. 14.19 skrev Thomas Caswell tcasw...@gmail.com:

Make sure you have `freetype-dev` installed at the system level. 
Tom
On Wed, Apr 1, 2015 at 8:02 AM Christian Ambros ambr...@ymail.com wrote:

Hi,
I'm facing the same trouble with installing matplotlib 1.4.3 and 1.5.dev1. 
running 

    python3 setup.py build 

in the unarchived directory gives this:

Edit setup.cfg to change the build options

BUILDING MATPLOTLIB
    matplotlib: yes [1.5.dev1]
    python: yes [3.4.0 (default, Apr 11 2014, 13:05:11)  [GCC
    4.8.2]]
  platform: yes [linux]

REQUIRED DEPENDENCIES AND EXTENSIONS
 numpy: yes [version 1.9.2]
   six: yes [using six version 1.5.2]
  dateutil: yes [using dateutil version 2.0]
  pytz: yes [using pytz version 2012c]
   tornado: yes [using tornado version 3.1.1]
 pyparsing: yes [using pyparsing version 2.0.1]
    libagg: yes [Requires patches that have not been merged
    upstream. Using local copy.]
Traceback (most recent call last):
  File setup.py, line 153, in module
    result = package.check()
  File /home/ambrosc/Downloads/matplotlib-master/setupext.py, line 900, in 
check
    min_version='2.3', version=version)
  File /home/ambrosc/Downloads/matplotlib-master/setupext.py, line 446, in 
_check_for_pkg_config
    if (not is_min_version(version, min_version)):
  File /home/ambrosc/Downloads/matplotlib-master/setupext.py, line 173, in 
is_min_version
    return found_version = expected_version
  File /usr/lib/python3.4/distutils/version.py, line 76, in __ge__
    c = self._cmp(other)
  File /usr/lib/python3.4/distutils/version.py, line 343, in _cmp
    if self.version  other.version:
TypeError: unorderable types: str()  int()

I'm running Linux Mint 17 Quina which is based on Ubuntu's trusty packges.
pip3 is up to date. Running     
    print(setuptools.__file__)
gives: /usr/local/lib/python3.4/dist-packages/setuptools/__init__.py which is 
as expected.
Using pip3 install matplotlib --upgrade #even to 1.4.3get's me this:

Collecting matplotlib from 
https://pypi.python.org/packages/source/m/matplotlib/matplotlib-1.4.3.tar.gz#md5=86af2e3e3c61849ac7576a6f5ca44267
  Downloading matplotlib-1.4.3.tar.gz (50.4MB)
    100% || 50.4MB 8.0kB/s 
    Traceback (most recent call last):
  File string, line 20, in module
  File /tmp/pip-build-sezmzam8/matplotlib/setup.py, line 155, in module
    result = package.check()
  File /tmp/pip-build-sezmzam8/matplotlib/setupext.py, line 961, in check
    min_version='2.3', version=version)
  File /tmp/pip-build-sezmzam8/matplotlib/setupext.py, line 445, in 
_check_for_pkg_config
    if (not is_min_version(version, min_version)):
  File /tmp/pip-build-sezmzam8/matplotlib/setupext.py, line 173, in 
is_min_version
    return found_version = expected_version
  File /usr/lib/python3.4/distutils/version.py, line 76, in __ge__
    c = self._cmp(other)
  File /usr/lib/python3.4