[Matplotlib-users] py2exe and matplotlib errors when executing exe

2010-05-17 Thread New2Python

Hi All,

I hope someone can help, I have run into a few problems when trying to
execute an exe file created when I use py2exe with matplotlib.
I have python2.5, matplotlib v0.99.1 and py2exe from GUI2Exe v0.5.0
optimisation is python -OO
the files compile correctly however when I execute the exe I get an error as
shown below
this is an extract

  File "matplotlib\mlab.pyo", line 380, in 
TypeError: unsupported operand type(s) for %: 'NoneType' and 'dict'

the traceback points to this line of my code

from matplotlib.backends.backend_wxagg import NavigationToolbar2WxAgg

does anyone know how to solve this, i have seen references made to numpy but
not matplotlib

Regards

Marco



-- 
View this message in context: 
http://old.nabble.com/py2exe-and-matplotlib-errors-when-executing-exe-tp28589875p28589875.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


--

___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] py2exe and matplotlib errors when executing exe

2010-05-18 Thread New2Python

Thanks, must have skipped over that one - I added the statements and it has
fixed it :) however now there is an issue elsewhere. I get the message

  File "matplotlib\backends\__init__.pyo", line 25, in pylab_setup
ImportError: No module named backend_tkagg

and the traceback call this

from pylab import *

I have _tkagg as an exclude

looks like somebody else had this problem but nobody solved it
http://mail.scipy.org/pipermail/scipy-user/2005-July/004777.html

any one know how to solve this?

I tried to include matplotlib.backends.backend_tkagg, then this popped up
with a tkinter import error.

Regards

Marco






New2Python wrote:
> 
> Hi All,
> 
> I hope someone can help, I have run into a few problems when trying to
> execute an exe file created when I use py2exe with matplotlib.
> I have python2.5, matplotlib v0.99.1 and py2exe from GUI2Exe v0.5.0
> optimisation is python -OO
> the files compile correctly however when I execute the exe I get an error
> as shown below
> this is an extract
> 
>   File "matplotlib\mlab.pyo", line 380, in 
> TypeError: unsupported operand type(s) for %: 'NoneType' and 'dict'
> 
> the traceback points to this line of my code
> 
> from matplotlib.backends.backend_wxagg import NavigationToolbar2WxAgg
> 
> does anyone know how to solve this, i have seen references made to numpy
> but not matplotlib
> 
> Regards
> 
> Marco
> 
> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/py2exe-and-matplotlib-errors-when-executing-exe-tp28589875p28595304.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


--

___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] py2exe and matplotlib errors when executing exe

2010-05-18 Thread New2Python

Thanks, I changed the matplotlibrc file to use the WXAgg backend and then had
to copy the file into the mpl.get_configdir() and in my local working dir
for it to work.

The file runs however a python error screen pops up and then closes without
giving me the chance to read it, anybody know how to stop the window from
closing so quickly

Thanks

Marco



Michael Droettboom-3 wrote:
> 
> It should only try to import that backend when configured to do so.  You 
> may need to change your matplotlibrc to point to your desired backend.
> 
> Mike
> 
> New2Python wrote:
>> Thanks, must have skipped over that one - I added the statements and it
>> has
>> fixed it :) however now there is an issue elsewhere. I get the message
>>
>>   File "matplotlib\backends\__init__.pyo", line 25, in pylab_setup
>> ImportError: No module named backend_tkagg
>>
>> and the traceback call this
>>
>> from pylab import *
>>
>> I have _tkagg as an exclude
>>
>> looks like somebody else had this problem but nobody solved it
>> http://mail.scipy.org/pipermail/scipy-user/2005-July/004777.html
>>
>> any one know how to solve this?
>>
>> I tried to include matplotlib.backends.backend_tkagg, then this popped up
>> with a tkinter import error.
>>
>> Regards
>>
>> Marco
>>
>>
>>
>>
>>
>>
>> New2Python wrote:
>>   
>>> Hi All,
>>>
>>> I hope someone can help, I have run into a few problems when trying to
>>> execute an exe file created when I use py2exe with matplotlib.
>>> I have python2.5, matplotlib v0.99.1 and py2exe from GUI2Exe v0.5.0
>>> optimisation is python -OO
>>> the files compile correctly however when I execute the exe I get an
>>> error
>>> as shown below
>>> this is an extract
>>>
>>>   File "matplotlib\mlab.pyo", line 380, in 
>>> TypeError: unsupported operand type(s) for %: 'NoneType' and 'dict'
>>>
>>> the traceback points to this line of my code
>>>
>>> from matplotlib.backends.backend_wxagg import NavigationToolbar2WxAgg
>>>
>>> does anyone know how to solve this, i have seen references made to numpy
>>> but not matplotlib
>>>
>>> Regards
>>>
>>> Marco
>>>
>>>
>>>
>>>
>>> 
>>
>>   
> 
> -- 
> Michael Droettboom
> Science Software Branch
> Operations and Engineering Division
> Space Telescope Science Institute
> Operated by AURA for NASA
> 
> 
> --
> 
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
> 

-- 
View this message in context: 
http://old.nabble.com/py2exe-and-matplotlib-errors-when-executing-exe-tp28589875p28602527.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


--

___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] from pylab import nx?

2008-05-07 Thread New2Python

Hi All,

I have the same issue, is there a fix to this



Michael Droettboom-3 wrote:
> 
> Eric Firing wrote:
>> Chris Withers wrote:
>>   
>>> Hi All,
>>>
>>> A few of the units demos include the lines:
>>>
>>> from pylab import nx
>>>
>>> ...but this import errors for me.
>>>
>>> Why is that?
>>> 
>>
>> If you are referring to scripts in the matplotlib/examples/ subdirectory 
>> then you must have a version in which some of those scripts had not been 
>> brought up to date with the rest of matplotlib. (Historically, this has 
>> often been the case--only a subset of the examples are maintained. 
>> Right now, for example, simple3d.py is broken.  3D plotting is itself 
>> unmaintained, so there is little incentive to do anything about the 
>> example.) In the svn version there are no lines importing nx.  This was 
>> an abbreviation for the numerix module, which was a compatibility 
>> wrapper for the three different numeric packages (Numeric, numarray, and 
>> numpy)  until numpy was fully developed, rendering Numeric and numarray 
>> obsolete.
>>   
> Slightly OT, but if matplotlib is participating in any sort of 
> internship projects (Google Summer of Code etc.) that would be a great 
> student project -- to clean up all the examples, removing dead ones, 
> editing for consistency etc.
> 
> Cheers,
> Mike
> 
> -
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
> 

-- 
View this message in context: 
http://www.nabble.com/from-pylab-import-nx--tp16118581p17105429.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


-
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Plotting single marker point at zoomed level

2008-05-28 Thread New2Python

Thanks for that, the canvas.draw() function redraws the graph. I had to add
the "autoscale_on=False" to the add_subplot() to stop the graph from
autoscaling. 
 
One issue that I find now is that the removed marker is not redrawn as
removed, in other words, all the original markers remain drawn whether or
not the datapoints exist in the array. How can I remove the marker I don't
want anymore withought doing a clf() call because I can have over 300,000
datapoints and the redraw will take ages
 
Thanks for the link to the clipping code, that will come in handy. Much
appreciated


John Hunter-4 wrote:
> 
> On Mon, May 26, 2008 at 10:08 AM, John Hunter <[EMAIL PROTECTED]> wrote:
>> On Mon, May 26, 2008 at 7:01 AM, New2Python <[EMAIL PROTECTED]>
>> wrote:
>>
>>> I hope someone can give me a simple solution to my problem. I have a
>>> line
>>> plotted and I need to be able to mark selected data points on the line.
>>> I am
>>
>> If you are frequently changing the zoom level, as it looks like you
>> are, the copy background/restore region/blit idiom is probably not the
>> right one for you, since the background is assumed fixed.  You can
>> simply force a draw at any time by doing fig.canvas.draw() w/o having
>> to zoom out or resize to trigger a draw.  So after doing the
>> self.marker.set_data call, I would do fig.canvas.draw
> 
> I thought this would be a generally useful thing to do (maintain a
> list of toggleable selected vertices) so I added some support. Here is
> some example code to highlight the selected markers:
> 
> """
> The matplotlib.lines.VertexSelector maintains a list of selected line
> vertices using the line picker property. If an unselected vertex is
> clicked, it is selected, and if a selected vertex is clicked, it is
> unselectedit.
> 
> Classes which inherit from the VertexSelector should override the
> process_selected method to do something with the selected vertex. This
> example just highlights them with red markers.  If you don't have
> access to svn, I can send you a free-standing example.
> 
> 
> """
> The matplotlib.lines.VertexSelector maintains a list of selected line
> vertices using the line picker property. If an unselected vertex is
> clicked, it is selected, and if a selected vertex is clicked, it is
> unselectedit.
> 
> Classes which inherit from the VertexSelector should override the
> process_selected method to do something with the selected vertex. This
> example just highlights them with red markers.
> 
> """
> 
> import numpy as np
> import matplotlib.pyplot as plt
> import matplotlib.lines as lines
> 
> class HighlightSelected(lines.VertexSelector):
> """
> Highlight the selected vertices with a marker plot
> """
> def __init__(self, line, fmt='ro', **kwargs):
> """
> highlight the selected vertices of line with a marker plot.
> The plot format string are given by fmt and the kwargs are
> additional
> line properties
> """
> lines.VertexSelector.__init__(self, line)
> self.markers, = self.axes.plot([], [], fmt, **kwargs)
> 
> def process_selected(self, ind, xs, ys):
> """
> ind are the indices of the selected vertices.  xs and ys are
> the coordinates of the selected vertices.
> """
> self.markers.set_data(xs, ys)
> self.canvas.draw()
> 
> fig = plt.figure()
> ax = fig.add_subplot(111)
> x, y = np.random.rand(2, 30)
> line, = ax.plot(x, y, 'bs-', picker=5)
> 
> selector = HighlightSelected(line)
> plt.show()
> 
> -
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Plotting-single-marker-point-at-zoomed-level-tp17470649p17511209.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Plotting single marker point at zoomed level

2008-05-29 Thread New2Python

Thanks for that, 

I already have a button to enable picking mode and the original post shows
that I have already tried the copy background/restore/blit, however I must
have been doing something wrong.
Pehaps you can point out what the issue was ro where I was going wrong


John Hunter-4 wrote:
> 
> On Wed, May 28, 2008 at 7:10 AM, New2Python <[EMAIL PROTECTED]>
> wrote:
> 
>> One issue that I find now is that the removed marker is not redrawn as
>> removed, in other words, all the original markers remain drawn whether or
>> not the datapoints exist in the array. How can I remove the marker I
>> don't
>> want anymore withought doing a clf() call because I can have over 300,000
>> datapoints and the redraw will take ages
> 
> You will need to do some extra work here.  I would have a "picking
> mode" which is enabled by a key-stroke or button press, and when the
> mode is enabled, you can copy the background using the
> copy_background/restore region/blit techniques discussed at
> http://www.scipy.org/Cookbook/Matplotlib/Animations.  Then you can
> mark your vertices and just draw the vertex marker line over the
> background.  Alternatively, you can use the clipped line approach I
> pointed you to in my prior post to only plot the vertices in the
> viewport.  You will have to do a little bookkeeping to translate the
> marked vertices in the viewport to the ones in the original dataset.
> 
> Unfortunately, I don't have time to write the complete example right
> now...
> 
> JDH
> 
> -
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Plotting-single-marker-point-at-zoomed-level-tp17470649p17550943.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users