Re: [Matplotlib-users] Backend Agg - show plot

2008-02-18 Thread Chris Kennedy

hi, try this. It is simpler then some of the examples:

import pylab
# func - list of X, Y coordinates
func = [ 0, 0, 1, 2, 2, 3, 3, 2, 4, 1, 5, 1.4, ]
#
pylab.plot(func[0::2], func[1::2], 'b-', linewidth=3)
pylab.title(' Plot for function ...')
pylab.xlabel(' X name ')
pylab.ylabel(' Y name ' )
pylab.grid(True)
pylab.show()
#pylab.savefig('blahblah.png', facecolor='lightgrey', edgecolor='w')
pylab.close()
#


sa6113 wrote:

Thanks alot for your help, I could show the plot on the screen on python 2.4
.
I've used pyhton 2.3 .


Eric Firing wrote:
  

sa6113 wrote:


How should I darw and show a plot using Backend Agg , I don't want to
save
figure , just show ?
  
If you don't want to save a figure, then you will need an interactive 
backend--not Agg, but TkAgg or GtkAgg etc.  Then you end your script 
with show() (imported from pylab or matplotlib.pyplot), and the plot 
will be diplayed on your screen.  (The plain Agg backend is useful only 
with savefig(...) to generate png files.)


Check out the examples directory in the distribution.

Eric

-
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





  


--
Chris Kennedy  http://www.coventor.com
Sr. Product ManagerPh: 919-854-7500 x156
Cary, NC   Fx: 919-854-7501
  Mobile: 919-414-6653
  
  

-
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.

2008-02-15 Thread Chris Kennedy
hi Mike,
It only prints what is between the , - . I tend to think it is 
related to Tkinter.

I'm using the default GTKAgg.

I have generated over 1500 images using the simple example with no 
issue. When it is in the larger app, it fails on the 2nd or 3rd request.

I'm trying
reload(matplotlib)
matplotlib.use('TkAgg')

Are there some python flags I can use when running the script to get 
more verbose output?  I've used -v and -d and get the cleanup list, is 
that useful?

thanks

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



-- 
Chris Kennedy  http://www.coventor.com
Sr. Product ManagerPh: 919-854-7500 x156
Cary, NC   Fx: 919-854-7501
   Mobile: 919-414-6653
   
   



-
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] Fail to allocate bitmap, Unable to free colormap, palette is still selected.

2008-02-15 Thread Chris Kennedy
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

-- 
Chris Kennedy  http://www.coventor.com
Sr. Product ManagerPh: 919-854-7500 x156
Cary, NC   
  
   
   



-
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.

2008-02-15 Thread Chris Kennedy
hi Mike,

I was able to get it to work using:

reload(matplotlib)
matplotlib.use('Agg')

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;
}

thanks

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



-- 
Chris Kennedy  http://www.coventor.com
Sr. Product ManagerPh: 919-854-7500 x156
Cary, NC   
  
   
   



-
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