Re: [Matplotlib-users] Showing the plot in the specific location
I am writting an application that evaluate curve fit and draw its plot in a GUI , I want to draw or show the plot on the GUI not on the pop up window, but I don't want to save the figure in first step , user just enter an order for the curve fit and see their plots on the main window (GUI) . How can I use pylab for this purpose , does it return and QImage object for exm. ? sa6113 wrote: How can I show my plot figure in the specific location or part of an application , I am using pylab. -- View this message in context: http://www.nabble.com/Showing-the-plot-in-the-specific-location-tp15545079p15560493.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] automatically choose line markers/styles?
Alan G Isaac wrote: On Thu, 14 Feb 2008, Neal Becker apparently wrote: Can I get nice default line styles and markers, automatically set up with matching legend? Automatically chosen? I don't want to have to go through and manually choose each marker and line style. Well, you have to ask for a legend, but everything else default looks good to me. What is an example where you do not like the default behavior? Are you trying to make a bunch of figures look alike? IIUC, in order to have each line with distinct line style, I have to explicitly set the line style. I want pylab to just choose them, just as it does for colors. - 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] Showing the plot in the specific location
On Mon, 18 Feb 2008, apparently wrote: I am writting an application that evaluate curve fit and draw its plot in a GUI , I want to draw or show the plot on the GUI not on the pop up window, but I don't want to save the figure in first step , user just enter an order for the curve fit and see their plots on the main window (GUI) . How can I use pylab for this purpose , does it return and QImage object for exm. ? I believe John already told you this: do NOT use pylab. See URL:http://matplotlib.sourceforge.net/leftwich_tut.txt and the other resources that have been posted on this list. Cheers, Alan Isaac - 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] Fail to allocate bitmap, Unable to free colormap, palette is still selected.
Chris Kennedy wrote: hi Mike, I was able to get it to work using: reload(matplotlib) matplotlib.use('Agg') That suggests that the bug is somehow related to GUI code. As John pointed out, we'll want to very exactly which GUI backend is being used. I'll have to beat on it some more to see if this is robust. I saw the error message in this code: http://search.cpan.org/src/NI-S/Tk-804.027/pTk/mTk/win/tkWinDraw.c if(!bitmap) { panic(Fail to allocate bitmap\n); DeleteDC(dcMem); TkWinReleaseDrawableDC(d, dc, state); return; } That seems to suggest that the TkAgg backend (or Tkinter itself) is somehow the problem, assuming Gtk doesn't issue the same message (unlikely). Thanks. Please let us know what other clues you can collect. Cheers, Mike Michael Droettboom wrote: Can you provide the full traceback for the error? Are there no Python line numbers etc.? I don't see the string Fail to allocate bitmap or Unable to free colormap... anywhere in the matplotlib source, so it's hard to say where it's coming from. I suspect they are coming from the GUI framework you are using... If you put your simple example inside of a loop, does the error eventually occur -- or only within the context of your app? If the latter, we'll need to somehow narrow it down to a specific setting or method that causes the problem. Also, what backend are you using when it breaks? Just Agg, or one of the Gui+Agg backends? Cheers, Mike Chris Kennedy wrote: hi, I get this error when I'm generating numerous .png files using matplotlib 0.9.2 in py2.4 on WinXP - Fail to allocate bitmap This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information. Unable to free colormap, palette is still selected. This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information. - The code is simple: import matplotlib import matplotlib.pyplot as pylab pylabFigure = pylab.figure() pylabFigure.clf() pylab.rcdefaults() pylab.plot(p[0::2], p[1::2], 'b-', linewidth=3) pylab.title('Endpointing Plot for '+StepMillName) pylab.xlabel('Mill Distance ('+m_unit+')') pylab.ylabel('~ Electron response ~' ) pylab.grid(True) pylabFigure.savefig('EPP_'+StepMillName+'.png', facecolor='lightgrey', edgecolor='w') pylab.close('all') pylabFigure = None I can put this code in a simple program and generate many images without seeing the allocate bitmap error. Perhaps it is colliding with something else in my main app. Is there a command that can clear, flush, or unselect the palette and/or colormap? I don't see the allocate error if I switch the backend to 'SVG', that has it own set of issues though: telling me it can't use, but then generating SVG files anyway. thanks -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - 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] Showing the plot in the specific location
On Feb 19, 2008 3:32 AM, sa6113 [EMAIL PROTECTED] wrote: I am writting an application that evaluate curve fit and draw its plot in a GUI , I want to draw or show the plot on the GUI not on the pop up window, but I don't want to save the figure in first step , user just enter an order for the curve fit and see their plots on the main window (GUI) . How can I use pylab for this purpose , does it return and QImage object for exm. ? In addition to the tutorial Alan pointed out to you, take a look at http://matplotlib.sourceforge.net/examples/embedding_in_qt.py http://matplotlib.sourceforge.net/examples/embedding_in_qt4.py and http://matplotlib.sf.net/faq.html#OO 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
[Matplotlib-users] Memory trouble with imshow
Dear all, I ran into a memory problem when trying to draw a few hundred png files using one imshow per file. The problem can be boiled down to the attached code which eats my memory very quickly until Python bombs out. I tried to del objects after their use, looked for garbage and read the user manual, but no luck. Did I do anything wrong or is this a memory leak? Cheers, Leif # discovered odd behaviour in relation to the imshow function # memory usage will go up quickly until the runtime breaks # watch it with the task manager # lxo, 19.02.2008 # running matplotlib-0.91.2.win32-py2.5.exe with wxPython 2.8.4.0 on Python 2.5.1 from pylab import * import gc for i in range (1000): A=rand(1024,1024) im = imshow(A) #del A #doesn't help #del im #doesn't help #print gc.garbage # no garbage This message has been checked for viruses but the contents of an attachment may still contain software viruses, which could damage your computer system: you are advised to perform your own checks. Email communications with the University of Nottingham may be monitored as permitted by UK legislation. - 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] Memory trouble with imshow
On Feb 19, 2008 8:37 AM, Leif Oppermann [EMAIL PROTECTED] wrote: from pylab import * import gc for i in range (1000): A=rand(1024,1024) im = imshow(A) #del A #doesn't help #del im #doesn't help #print gc.garbage # no garbage matplotlib overplots by default -- try setting hold(False) before your loop, and call gc.collect() occassionally eg if (i%100)==0: gc.collect() 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
Re: [Matplotlib-users] automatically choose line markers/styles?
On Tue, 19 Feb 2008, Neal Becker apparently wrote: IIUC, in order to have each line with distinct line style, I have to explicitly set the line style. I want pylab to just choose them, just as it does for colors. Well, pylab does choose: it varies color and not the dash pattern in order to have distinct lines. I think what you are wanting is something like the following: have pylab/pyplot cycle automatically through a set of preset Line2D property combinations, when an axes plots multiple lines. I think the answer is: this is not available in the form you want. (Indeed, it is hard for me to imagine agreement on nice choices for multiple properties.) Of course you can do something like this:: from itertools import cycle mystyles = ['r+-', 'b.--', 'go-.'] #etc ax1styles = cycle( mystyles ) for x,y in data: ax1.plot(x, y, ax1styles.next()) Cheers, Alan Isaac - 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] automatically choose line markers/styles?
On Feb 19, 2008 9:13 AM, Alan G Isaac [EMAIL PROTECTED] wrote: Of course you can do something like this:: from itertools import cycle mystyles = ['r+-', 'b.--', 'go-.'] #etc ax1styles = cycle( mystyles ) You can also cycle through the list matplotlib uses import matplotlib.lines as lines # filled markers fmarkers = lines.Line2D.filled_markers # all markers markers = lines.Line2D.markers.keys() but this is not ideal, since lines.Line2D.markers is a dictionary and the keys will come back un-ordered. Noone has every asked for auto-marker cycling before, but it might be a good idea and wouldn't be too hard to add. 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
Re: [Matplotlib-users] MatPlotLib + Py2exe, backend problems ...
With Stef's help, I was able to get pass the Matplotlib datafile not found problem in using py2exe and Matplotlib under Python 2.3 - but then ran into the same Tkinter not loaded problem like he did. After reading Stef's messages from this list, I downloaded the latest version of Matplotlib - only to find that Python 2.3 is no longer supported. So, I loaded up Python 2.5 and ran the setup script for Py2exe. Now, py2exe is unable to find wxmsw26uh_vc.dll - eventhough I have wxPython 2.8 installed. So, I dug up a copy of wxPython 2.6 and have that installed. The file is now there but py2exe still can't find it. This is very fustrating! Date: Mon, 18 Feb 2008 21:09:07 -0600 From: John Hunter [EMAIL PROTECTED] Subject: Re: [Matplotlib-users] [wxPython-users] Re: MatPlotLib + Py2exe, backend problems ... To: Stef Mientki [EMAIL PROTECTED] Cc: matplotlib-users@lists.sourceforge.net Message-ID: [EMAIL PROTECTED] Content-Type: text/plain; charset=ISO-8859-1 On Feb 18, 2008 1:11 PM, Stef Mientki [EMAIL PROTECTED] wrote: What is setup.cfg, where can I find it and where can I get information about it ? Let's keep this on matplotlib-users so we don't annoy the good folks at the wxpython and distutils lists... setup.cfg is a build/configure file that ships w/ matplotlib in recent versions (0.91.x). If it is not in your source distribution, let us know which distro you are using, where you got it from, what you have already, etc Among other things, it lets you conditionally turn of/off builds of certain GUI backends and other optional features. JDH -- -- John Henry - 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] [wxPython-users] Re: MatPlotLib + Py2exe, backend problems ...
hi John, John Hunter wrote: On Feb 18, 2008 1:11 PM, Stef Mientki [EMAIL PROTECTED] wrote: What is setup.cfg, where can I find it and where can I get information about it ? Let's keep this on matplotlib-users so we don't annoy the good folks at the wxpython and distutils lists... If you google for this problem you will be surprised how many people bump into these two problem, ( matplot datafiles and the tk-issue ) But ok, let's first find the solution ;-) setup.cfg is a build/configure file that ships w/ matplotlib in recent versions (0.91.x). If it is not in your source distribution, let us know which distro you are using, __version__ = '0.91.2' __revision__ = '$Revision: 4802 $' __date__ = '$Date: 2008-01-06 12:10:34 -0500 (Sun, 6 Jan 2008) $' where you got it from, probably: http://sourceforge.net/project/showfiles.php?group_id=80706 matplotlib-0.91.2.win32-py2.4.exe what you have already, etc Although I don't see how this can delete a setup.cfg from matplotlib, .. Windows XP, SP2 Python 2.4 Scipy (enthought edition), with a crashed update through eggs enstaller :-(, but everything stiil seems to work fine wxPython 2.8 msw ansi btw, i just saw this on matplotlibrc CONFIGURATION BEGINS HERE # the default backend; one of GTK GTKAgg GTKCairo FltkAgg QtAgg TkAgg # WX WXAgg Agg Cairo GD GDK Paint PS PDF SVG Template backend : TkAgg numerix : numpy # numpy, Numeric or numarray cheers, Stef Among other things, it lets you conditionally turn of/off builds of certain GUI backends and other optional features. 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
Re: [Matplotlib-users] MatPlotLib + Py2exe, backend problems ...
hi John, [EMAIL PROTECTED] wrote: With Stef's help, I was able to get pass the Matplotlib datafile not found problem in using py2exe and Matplotlib under Python 2.3 - but then ran into the same Tkinter not loaded problem like he did. After reading Stef's messages from this list, I downloaded the latest version of Matplotlib - only to find that Python 2.3 is no longer supported. So, I loaded up Python 2.5 and ran the setup script for Py2exe. Now, py2exe is unable to find wxmsw26uh_vc.dll - eventhough I have wxPython 2.8 installed. So, I dug up a copy of wxPython 2.6 and have that installed. The file is now there but py2exe still can't find it. This is very fustrating! and it's even more frustrated that was discussed recently in again another list (wxPython-list) ;-) Here was the solution: Ok I updated MatPlot from version from 0.87.7 to 0.91.2 cheers, Stef - 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] [wxPython-users] Re: MatPlotLib + Py2exe, backend problems ...
I'm not an expert but I thought I'd try and help... On Feb 19, 2008 7:15 PM, Stef Mientki [EMAIL PROTECTED] wrote: where you got it from, probably: http://sourceforge.net/project/showfiles.php?group_id=80706 matplotlib-0.91.2.win32-py2.4.exe This is a binary distribution, that is one that has already been compiled on a different machine. This won't have the setup.cfg file, since it is a file that is used to configure the compilation process of matplotlib. Also this is why you can only use this distribution with specific versions of python, wx etc. If you choose to compile matplotlib yourself, then you have the option of completely disabling some of the backends, which is done via a setting in the setup.cfg file. I am not sure how easy it is to build matplotlib on windows, but on other platforms it is relatively straightforward. After obtaining the source distribution, ensure you have the requirements (including any development files) for the backends you want. Select the backends to build in setup.cfg and run python setup.py build followed by python setup.py install Hope this at least clears up the missing setup.cfg issue... Robin - 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] MatPlotLib + Py2exe, backend problems ...
So, do I understand this correctly: In order to get rid of the Tkinter problem when building a matplotlib application using py2exe, I need 0.91.2 ver of matplotlib and use the setup.cfg file to select the backend I want (wxpython in my case). Then run py2exe to build the ap. Correct? But then, as I posted earlier, this create a new problem for me in that py2exe says it can't find wxmsw26uh_vc.dll - even though the file exists. What I need is a version of 0.91.2 ver of matplotlib that works with Python 2.3 to see if that works, or I guess I would include Tkinter with my exe? Do I understand all these correctly? -Original Message- Here was the solution: Ok I updated MatPlot from version from 0.87.7 to 0.91.2 cheers, Stef -- John Henry - 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] MatPlotLib + Py2exe, backend problems ...
[EMAIL PROTECTED] wrote: What I need is a version of 0.91.2 ver of matplotlib that works with Python 2.3 to see if that works... I might be misremembering, but I thought 0.91.2 worked with Python 2.3. I don't use 2.3 every day, however. Can you send the errors that are produced when you build or run matplotlib 0.91.2 with Python 2.3? Or are you just referring to the fact that there are no Windows binaries provided for Python 2.3? Cheers, Mike -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - 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] MatPlotLib + Py2exe, backend problems ...
Michael, I am referring to the fact that there are no Windows binaries provided for Python 2.3. If I simply copy the matplotlib directory over to Python23, py2exe will get confused. I have no clue how to build it for Python23. I don't even have any C compiler. -Original Message- From: Michael Droettboom [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 19, 2008 12:19 PM To: [EMAIL PROTECTED] Cc: matplotlib-users@lists.sourceforge.net Subject: Re: [Matplotlib-users] MatPlotLib + Py2exe, backend problems ... [EMAIL PROTECTED] wrote: What I need is a version of 0.91.2 ver of matplotlib that works with Python 2.3 to see if that works... I might be misremembering, but I thought 0.91.2 worked with Python 2.3. I don't use 2.3 every day, however. Can you send the errors that are produced when you build or run matplotlib 0.91.2 with Python 2.3? Or are you just referring to the fact that there are no Windows binaries provided for Python 2.3? Cheers, Mike -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA -- John Henry - 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