SourceForge logo
SourceForge logo
Menu

matplotlib-devel — matplotlib developers

You can subscribe to this list here.

2003 Jan
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
(1)
Nov
(33)
Dec
(20)
2004 Jan
(7)
Feb
(44)
Mar
(51)
Apr
(43)
May
(43)
Jun
(36)
Jul
(61)
Aug
(44)
Sep
(25)
Oct
(82)
Nov
(97)
Dec
(47)
2005 Jan
(77)
Feb
(143)
Mar
(42)
Apr
(31)
May
(93)
Jun
(93)
Jul
(35)
Aug
(78)
Sep
(56)
Oct
(44)
Nov
(72)
Dec
(75)
2006 Jan
(116)
Feb
(99)
Mar
(181)
Apr
(171)
May
(112)
Jun
(86)
Jul
(91)
Aug
(111)
Sep
(77)
Oct
(72)
Nov
(57)
Dec
(51)
2007 Jan
(64)
Feb
(116)
Mar
(70)
Apr
(74)
May
(53)
Jun
(40)
Jul
(519)
Aug
(151)
Sep
(132)
Oct
(74)
Nov
(282)
Dec
(190)
2008 Jan
(141)
Feb
(67)
Mar
(69)
Apr
(96)
May
(227)
Jun
(404)
Jul
(399)
Aug
(96)
Sep
(120)
Oct
(205)
Nov
(126)
Dec
(261)
2009 Jan
(136)
Feb
(136)
Mar
(119)
Apr
(124)
May
(155)
Jun
(98)
Jul
(136)
Aug
(292)
Sep
(174)
Oct
(126)
Nov
(126)
Dec
(79)
2010 Jan
(109)
Feb
(83)
Mar
(139)
Apr
(91)
May
(79)
Jun
(164)
Jul
(184)
Aug
(146)
Sep
(163)
Oct
(128)
Nov
(70)
Dec
(73)
2011 Jan
(235)
Feb
(165)
Mar
(147)
Apr
(86)
May
(74)
Jun
(118)
Jul
(65)
Aug
(75)
Sep
(162)
Oct
(94)
Nov
(48)
Dec
(44)
2012 Jan
(49)
Feb
(40)
Mar
(88)
Apr
(35)
May
(52)
Jun
(69)
Jul
(90)
Aug
(123)
Sep
(112)
Oct
(120)
Nov
(105)
Dec
(116)
2013 Jan
(76)
Feb
(26)
Mar
(78)
Apr
(43)
May
(61)
Jun
(53)
Jul
(147)
Aug
(85)
Sep
(83)
Oct
(122)
Nov
(18)
Dec
(27)
2014 Jan
(58)
Feb
(25)
Mar
(49)
Apr
(17)
May
(29)
Jun
(39)
Jul
(53)
Aug
(52)
Sep
(35)
Oct
(47)
Nov
(110)
Dec
(27)
2015 Jan
(50)
Feb
(93)
Mar
(96)
Apr
(30)
May
(55)
Jun
(83)
Jul
(44)
Aug
(8)
Sep
(5)
Oct
Nov
(1)
Dec
(1)
2016 Jan
Feb
Mar
(1)
Apr
May
Jun
(2)
Jul
Aug
(3)
Sep
(1)
Oct
(3)
Nov
Dec
2017 Jan
Feb
(5)
Mar
Apr
May
Jun
Jul
(3)
Aug
Sep
(7)
Oct
Nov
Dec
2018 Jan
Feb
Mar
Apr
May
Jun
Jul
(2)
Aug
Sep
Oct
Nov
Dec
S M T W T F S

1
(3)
2
(3)
3
(2)
4
(9)
5
(4)
6
7
(1)
8
(5)
9
(3)
10
(2)
11
12
13
14
(4)
15
16
17
18
(1)
19
20
21
22
(4)
23
(1)
24
(6)
25
(7)
26
(1)
27
28
(1)
29
(5)
30
(6)
31
(10)



Showing 5 results of 5

From: Charles M. <cm...@in...> - 2005年08月08日 16:18:51
	Alright, I think its ready to go. I can't say I am thrilled with the 
performance of the TkAgg compared to the GtkAgg. I get about 62fps compared to 
112fps for gtkagg. It is still a LOT faster.
	FYI, the current state of examples/animation_blit.py does nothing, and you 
print a fps for 200 frames when only 50 are actually drawn giving an 
unrealistically high fps measurement.
	Finally, could you please send me a windows-2.4 binary of current cvs. I have 
a project that I am wanting to use the blitting for the tkagg and I want to test 
on windows. I don't have a build environment for it. If it is too much 
trouble, it is not a big deal.
Thanks,
	Charlie
John Hunter wrote:
>>>>>>"Charles" == Charles Moad <cm...@in...> writes:
> 
> 
> Charles> 	I am really close on having blit work for the tkagg.
> Charles> I committed my changes. There is one problem left I was
> Charles> hoping you could help on. I blit the axes in the right
> Charles> place, but it is blitting the upper-left of the whole
> Charles> figure. Running your test script below, this is easily
> Charles> seen. How do I pass in just the pixmap of the area of
> Charles> interest?
> 
> You are very close :-)
> 
> You need to follow the logic of the "destbuffer" in _gtkagg src. This
> will either use the who agg pixBuffer if bbox is None, or else copy
> out the proper region of the agg pixel buffer into destbuffer. There
> is a boolean "needfree" that keeps track of whether you need to free
> the memory. This is true when bbox!=None since we have to allocate a
> temporary buffer to copy the rectangle of the pixBuffer into.
> 
> You then pass destbuffer instead of pixBuffer off to the tk drawing
> routine.
> 
> Thanks!
> JDH
> 
> bool needfree = false;
> 
> agg::int8u *destbuffer = NULL;
> if (args[2].ptr() == Py_None) {
> //bbox is None; copy the entire image
> destbuffer = aggRenderer->pixBuffer;
> destwidth = srcwidth;
> destheight = srcheight;
> deststride = srcstride;
> }
> else {
> //bbox is not None; copy the image in the bbox
> 
> Bbox* clipbox = static_cast<Bbox*>(args[2].ptr());
> double l = clipbox->ll_api()->x_api()->val() ; 
> double b = clipbox->ll_api()->y_api()->val();
> double r = clipbox->ur_api()->x_api()->val() ; 
> double t = clipbox->ur_api()->y_api()->val() ;
> 
> //std::cout << b << " " 
> //		<< t << " ";
> 
> destx = (int)l;
> desty = srcheight-(int)t;
> destwidth = (int)(r-l);
> destheight = (int)(t-b);
> deststride = destwidth*4;
> 
> needfree = true;
> destbuffer = new agg::int8u[deststride*destheight]; 
> if (destbuffer ==NULL) {
> 	throw Py::MemoryError("_gtkagg could not allocate memory for destbuffer");
> }
> 
> agg::rendering_buffer destrbuf;
> destrbuf.attach(destbuffer, destwidth, destheight, deststride);
> pixfmt destpf(destrbuf);
> renderer_base destrb(destpf);
> //destrb.clear(agg::rgba(1, 0, 0));
> 
> //std::cout << "rect " << r << " " << srcheight << " " << b << " ";
> agg::rect_base<int> region(destx, desty, (int)r, srcheight-(int)b); 
> destrb.copy_from(*aggRenderer->renderingBuffer, &region, 
> 		 -destx, -desty);
> 
> 
> }
> 
> 
> gdk_draw_rgb_32_image(drawable, gc, destx, desty, 
> 			 destwidth, 
> 			 destheight, 
> 			 GDK_RGB_DITHER_NORMAL,
> 			 destbuffer,
> 			 deststride);
> 
> if (needfree) delete [] destbuffer;
> 
> Charles> - Charlie
From: John H. <jdh...@ac...> - 2005年08月08日 15:06:08
>>>>> "Charles" == Charles Moad <cm...@in...> writes:
 Charles> 	I am really close on having blit work for the tkagg.
 Charles> I committed my changes. There is one problem left I was
 Charles> hoping you could help on. I blit the axes in the right
 Charles> place, but it is blitting the upper-left of the whole
 Charles> figure. Running your test script below, this is easily
 Charles> seen. How do I pass in just the pixmap of the area of
 Charles> interest?
You are very close :-)
You need to follow the logic of the "destbuffer" in _gtkagg src. This
will either use the who agg pixBuffer if bbox is None, or else copy
out the proper region of the agg pixel buffer into destbuffer. There
is a boolean "needfree" that keeps track of whether you need to free
the memory. This is true when bbox!=None since we have to allocate a
temporary buffer to copy the rectangle of the pixBuffer into.
You then pass destbuffer instead of pixBuffer off to the tk drawing
routine.
Thanks!
JDH
 bool needfree = false;
 agg::int8u *destbuffer = NULL;
 if (args[2].ptr() == Py_None) {
 //bbox is None; copy the entire image
 destbuffer = aggRenderer->pixBuffer;
 destwidth = srcwidth;
 destheight = srcheight;
 deststride = srcstride;
 }
 else {
 //bbox is not None; copy the image in the bbox
 
 Bbox* clipbox = static_cast<Bbox*>(args[2].ptr());
 double l = clipbox->ll_api()->x_api()->val() ; 
 double b = clipbox->ll_api()->y_api()->val();
 double r = clipbox->ur_api()->x_api()->val() ; 
 double t = clipbox->ur_api()->y_api()->val() ;
 
 //std::cout << b << " " 
 //		<< t << " ";
 destx = (int)l;
 desty = srcheight-(int)t;
 destwidth = (int)(r-l);
 destheight = (int)(t-b);
 deststride = destwidth*4;
 
 needfree = true;
 destbuffer = new agg::int8u[deststride*destheight]; 
 if (destbuffer ==NULL) {
	throw Py::MemoryError("_gtkagg could not allocate memory for destbuffer");
 }
 
 agg::rendering_buffer destrbuf;
 destrbuf.attach(destbuffer, destwidth, destheight, deststride);
 pixfmt destpf(destrbuf);
 renderer_base destrb(destpf);
 //destrb.clear(agg::rgba(1, 0, 0));
 
 //std::cout << "rect " << r << " " << srcheight << " " << b << " ";
 agg::rect_base<int> region(destx, desty, (int)r, srcheight-(int)b); 
 destrb.copy_from(*aggRenderer->renderingBuffer, &region, 
		 -destx, -desty);
 
 
 }
 gdk_draw_rgb_32_image(drawable, gc, destx, desty, 
			 destwidth, 
			 destheight, 
			 GDK_RGB_DITHER_NORMAL,
			 destbuffer,
			 deststride);
 
 if (needfree) delete [] destbuffer;
 Charles> - Charlie
From: Charles M. <cm...@in...> - 2005年08月08日 14:48:47
	I am really close on having blit work for the tkagg. I committed my changes. 
There is one problem left I was hoping you could help on. I blit the axes in 
the right place, but it is blitting the upper-left of the whole figure. 
Running your test script below, this is easily seen. How do I pass in just the 
pixmap of the area of interest?
- Charlie
John Hunter wrote:
>>>>>>"Charles" == Charles Moad <cm...@in...> writes:
> 
> 
> Charles> I added the blit method to the tkagg, but I don't know
> Charles> what needs to be done to take the bbox into account.
> Charles> Even as it stands I get 141 fps in animation_blit.py
> Charles> compared to gtk's 350 fps. Whoever is the tk expert, any
> Charles> clue on how to account for the bbox on blit updates?
> 
> Todd wrote this, but I can point you to the relevant section of code.
> 
> tkagg.blit(self._tkphoto, self.renderer._renderer, 2)
> 
> calls backends.tkagg.blit
> 
> def blit(photoimage, aggimage, colormode=1):
> tk = photoimage.tk
> try:
> tk.call("PyAggImagePhoto", photoimage, id(aggimage), colormode)
> except Tk.TclError, v:
> try:
> try:
> _tkagg.tkinit(tk.interpaddr(), 1)
> except AttributeError:
> _tkagg.tkinit(id(tk), 0)
> tk.call("PyAggImagePhoto", photoimage, id(aggimage), colormode)
> except (ImportError, AttributeError, Tk.TclError):
> raise
> 
> and PyAggImagePhoto is the relevant function which is defined in
> src/_tkagg.cpp
> 
> static int
> PyAggImagePhoto(ClientData clientdata, Tcl_Interp* interp,
> int argc, char **argv)
> {
> Tk_PhotoHandle photo;
> Tk_PhotoImageBlock block;
> PyObject* aggo;
> //...snip....
> 
> 
> 
> block.width = aggRenderer->get_width();
> block.height = aggRenderer->get_height();
> //std::cout << "w,h: " << block.width << " " << block.height << std::endl;
> block.pitch = block.width * nval;
> block.pixelPtr = aggRenderer->pixBuffer;
> /* Clear current contents */
> Tk_PhotoBlank(photo);
> /* Copy opaque block to photo image, and leave the rest to TK */
> Tk_PhotoPutBlock(photo, &block, 0, 0, block.width, block.height);
> 
> I assume the 0, 0 are the x and y offsets and block.width,
> block.height are the sizes of the rect to be transferred. By
> following the example of src/_gtkagg.cpp, you should be able to
> substitute in the information from the bbox where appropriate.
> 
> BTW, I am getting 51 FPS with Tkagg using your blit. My test script
> is below:
> 
> import matplotlib
> matplotlib.use('TkAgg')
> import sys
> import gtk, gobject
> import pylab as p
> import matplotlib.numerix as nx
> import time
> 
> ax = p.subplot(111)
> canvas = ax.figure.canvas
> 
> 
> # create the initial line
> x = nx.arange(0,2*nx.pi,0.01)
> line, = p.plot(x, nx.sin(x), animated=True)
> 
> def run(*args):
> background = canvas.copy_from_bbox(ax.bbox)
> # for profiling
> tstart = time.time()
> 
> while 1:
> # restore the clean slate background
> canvas.restore_region(background)
> # update the data
> line.set_ydata(nx.sin(x+run.cnt/10.0)) 
> # just draw the animated artist
> ax.draw_artist(line)
> # just redraw the axes rectangle
> canvas.blit(ax.bbox) 
> 
> if run.cnt==200:
> # print the timing info and quit
> print 'FPS:' , 200/(time.time()-tstart)
> sys.exit()
> 
> run.cnt += 1
> run.cnt = 0 
> 
> 
> manager = p.get_current_fig_manager()
> manager.window.after(100, run)
> 
> p.show()
> 
> 
> 
From: Steve C. <ste...@ya...> - 2005年08月08日 11:34:42
On Fri, 2005年08月05日 at 20:28 -0700,
mat...@li... wrote:
> >>>>> "John" == John Hunter <jdh...@ac...>
> writes:
> 
> John> I think we have a problem in GTK. In the script
> below, if
> John> you add a button or some other widget above the
> figure
> John> canvas, only a part of the canvas is updated in the
> John> motion_notify_event update. The distance from the
> top of
> John> the figure canvas to the part that is not updated is
> equal
> John> to the height of the widget packed above the canvas.
> You
> John> can observe this by resizing the window to make it
> taller or
> John> shorter and noting the vertical extent where the
> horizontal
> John> line disappears.
> 
> I think the answer is
> 
> def draw(self):
> # synchronous window redraw (like GTK+ 1.2 used to do)
> # Note: this does not follow the usual way that GTK
> redraws,
> # which is asynchronous redraw using calls to
> gtk_widget_queue_draw(),
> # which triggers an expose-event
> 
> # GTK+ 2.x style draw()
> #self._need_redraw = True
> #self.queue_draw()
> 
> # synchronous draw (needed for animation)
> x, y, w, h = self.allocation
> #print x, y, w, h
> self._pixmap_prepare (w, h)
> self._render_figure(self._pixmap, w, h)
> self._need_redraw = False
> self.window.draw_drawable
> (self.style.fg_gc[self.state],
> self._pixmap, 0, 0, 0, 0,
> w, h)
> ^^^^^^^^^^
That looks correct.
I was confusing the event.area rectangle with the allocation rectangle.
For event.area x,y is relative to the widget and "x,y,x,y,w,h" works.
But self.allocation x,y is relative to the parent so you need
"0,0,0,0,w,h".
Steve
Send instant messages to your online friends http://au.messenger.yahoo.com 
From: Charles M. <cm...@in...> - 2005年08月08日 01:03:00
	Yeah, sorry I haven't had much time to work on it lately. The save 
button is pretty much a place holder for what I was going to add. My 
last headache was making multiple figures/windows work.
Thanks,
	Charlie
Jeff Whitaker wrote:
> 
> The Matplotlib.nib directory is missing in the 0.83.2 source tarball. 
> It needs to be installed in <sys.prefix>/share/matplotlib for the 
> CocoaAgg backend to work. I manually retrieved it from CVS and put it 
> there, and it seems to work - except for the 'Save Figure'
> button which doesn't seem to do anything yet.
> 
> -Jeff
> 

Showing 5 results of 5

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /