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 9 results of 9

From: John H. <jdh...@ac...> - 2005年08月04日 20:05:10
>>>>> "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: Charles M. <cm...@in...> - 2005年08月04日 19:22:40
I added the blit method to the tkagg, but I don't know what needs to be done to 
take the bbox into account. Even as it stands I get 141 fps in 
animation_blit.py compared to gtk's 350 fps. Whoever is the tk expert, any clue 
on how to account for the bbox on blit updates?
- Charlie
Charles Moad wrote:
> The wiki example works fine. I'll follow that model. You mentioned 
> that only the GtkAgg was supported, but it "appears" that the TkAgg has 
> support as well???
> 
> Thanks as always,
> Charlie
> 
> John Hunter wrote:
> 
>>>>>>> "Charles" == Charles Moad <cm...@in...> writes:
>>
>>
>>
>> Charles> example/animation_blit.py works fine on my laptop, but
>> Charles> for some reason not obvious to me it is not working on my
>> Charles> desktop. Here is the error:
>> Charles> Traceback (most recent call last): File
>> Charles> "animation_blit.py", line 30, in update_line
>> Charles> ax.draw_artist(line) File
>> Charles> "/usr/local/lib/python2.4/site-packages/matplotlib/axes.py",
>> Charles> line 1336, in draw_artist assert self._cachedRenderer is
>> Charles> not None AssertionError
>>
>> Charles> Both machines are up-to-date with cvs. Any clues?
>>
>> The only way to get this error is if you call draw_artist before
>> draw. It could have something to do with the order of the calls in
>> the gtk idle machinery.
>>
>> Try the following which connects to the new "draw_event" to block
>> animation until after draw and background storage
>>
>> # For detailed comments on animation and the techniqes used here, see
>> # the wiki entry
>> # http://www.scipy.org/wikis/topical_software/MatplotlibAnimation
>> import sys
>> import gtk, gobject
>> import pylab as p
>> import matplotlib.numerix as nx
>> import time
>>
>> ax = p.subplot(111)
>> canvas = ax.figure.canvas
>>
>> # for profiling
>> tstart = time.time()
>>
>> # create the initial line
>> x = nx.arange(0,2*nx.pi,0.01)
>> line, = p.plot(x, nx.sin(x), animated=True)
>>
>> # save the clean slate background -- everything but the animated line
>> # is drawn and saved in the pixel buffer background
>> background = None
>>
>> def snap_background(self):
>> global background
>> background = canvas.copy_from_bbox(ax.bbox)
>>
>> p.connect('draw_event', snap_background)
>>
>> def update_line(*args):
>> if background is None: return True
>> # restore the clean slate background
>> canvas.restore_region(background)
>> # update the data
>> line.set_ydata(nx.sin(x+update_line.cnt/10.0)) # just draw 
>> the animated artist
>> ax.draw_artist(line)
>> # just redraw the axes rectangle
>> canvas.blit(ax.bbox) if update_line.cnt==50:
>> # print the timing info and quit
>> print 'FPS:' , 200/(time.time()-tstart)
>> sys.exit()
>>
>> update_line.cnt += 1
>> return True
>> update_line.cnt = 0
>>
>> gobject.idle_add(update_line)
>> p.show()
>>
>>
>>
> 
> 
> -------------------------------------------------------
> SF.Net email is Sponsored by the Better Software Conference & EXPO
> September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
> Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
> Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
> _______________________________________________
> Matplotlib-devel mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
From: John H. <jdh...@ac...> - 2005年08月04日 17:32:50
>>>>> "Steve" == Steve Chaplin <ste...@ya...> writes:
 Steve> Its good that this fixes the problem, but I don't see why
 Steve> flipping an image upside down should also change its
 Steve> size. There's probably still a bug in there somewhere, but
 Steve> its not too important if the SVG images look correct now.
I just simplified image handling, removing the "origin" arg to the
backend draw_image. In keeping with mpl's philosophy of keeping the
backends simple and dumb, I moved all the origin processing to the
front end.
There is a im.flipud_out() that flips and image upside down for the
backend. This is useful for backends whose default image orientation
is different than matplotlib's (see for example backend_gdk) but is
independent of the "origin" command.
I didn't port these changes to Cairo since I don't have that installed
right now, but Agg, GTK, PS and SVG are working.
JDH
From: Charles M. <cm...@in...> - 2005年08月04日 17:14:14
The wiki example works fine. I'll follow that model. You mentioned that only 
the GtkAgg was supported, but it "appears" that the TkAgg has support as well???
Thanks as always,
	Charlie
John Hunter wrote:
>>>>>>"Charles" == Charles Moad <cm...@in...> writes:
> 
> 
> Charles> example/animation_blit.py works fine on my laptop, but
> Charles> for some reason not obvious to me it is not working on my
> Charles> desktop. Here is the error:
> Charles> Traceback (most recent call last): File
> Charles> "animation_blit.py", line 30, in update_line
> Charles> ax.draw_artist(line) File
> Charles> "/usr/local/lib/python2.4/site-packages/matplotlib/axes.py",
> Charles> line 1336, in draw_artist assert self._cachedRenderer is
> Charles> not None AssertionError
> 
> Charles> Both machines are up-to-date with cvs. Any clues?
> 
> The only way to get this error is if you call draw_artist before
> draw. It could have something to do with the order of the calls in
> the gtk idle machinery.
> 
> Try the following which connects to the new "draw_event" to block
> animation until after draw and background storage
> 
> # For detailed comments on animation and the techniqes used here, see
> # the wiki entry
> # http://www.scipy.org/wikis/topical_software/MatplotlibAnimation
> import sys
> import gtk, gobject
> import pylab as p
> import matplotlib.numerix as nx
> import time
> 
> ax = p.subplot(111)
> canvas = ax.figure.canvas
> 
> # for profiling
> tstart = time.time()
> 
> # create the initial line
> x = nx.arange(0,2*nx.pi,0.01)
> line, = p.plot(x, nx.sin(x), animated=True)
> 
> # save the clean slate background -- everything but the animated line
> # is drawn and saved in the pixel buffer background
> background = None
> 
> def snap_background(self):
> global background
> background = canvas.copy_from_bbox(ax.bbox)
> 
> p.connect('draw_event', snap_background)
> 
> def update_line(*args):
> if background is None: return True
> # restore the clean slate background
> canvas.restore_region(background)
> # update the data
> line.set_ydata(nx.sin(x+update_line.cnt/10.0)) 
> # just draw the animated artist
> ax.draw_artist(line)
> # just redraw the axes rectangle
> canvas.blit(ax.bbox) 
> 
> if update_line.cnt==50:
> # print the timing info and quit
> print 'FPS:' , 200/(time.time()-tstart)
> sys.exit()
> 
> update_line.cnt += 1
> return True
> update_line.cnt = 0
> 
> gobject.idle_add(update_line)
> p.show()
> 
> 
> 
From: John H. <jdh...@ac...> - 2005年08月04日 17:01:09
>>>>> "Charles" == Charles Moad <cm...@in...> writes:
 Charles> example/animation_blit.py works fine on my laptop, but
 Charles> for some reason not obvious to me it is not working on my
 Charles> desktop. Here is the error:
 Charles> Traceback (most recent call last): File
 Charles> "animation_blit.py", line 30, in update_line
 Charles> ax.draw_artist(line) File
 Charles> "/usr/local/lib/python2.4/site-packages/matplotlib/axes.py",
 Charles> line 1336, in draw_artist assert self._cachedRenderer is
 Charles> not None AssertionError
 Charles> Both machines are up-to-date with cvs. Any clues?
The only way to get this error is if you call draw_artist before
draw. It could have something to do with the order of the calls in
the gtk idle machinery.
Try the following which connects to the new "draw_event" to block
animation until after draw and background storage
# For detailed comments on animation and the techniqes used here, see
# the wiki entry
# http://www.scipy.org/wikis/topical_software/MatplotlibAnimation
import sys
import gtk, gobject
import pylab as p
import matplotlib.numerix as nx
import time
ax = p.subplot(111)
canvas = ax.figure.canvas
# for profiling
tstart = time.time()
# create the initial line
x = nx.arange(0,2*nx.pi,0.01)
line, = p.plot(x, nx.sin(x), animated=True)
# save the clean slate background -- everything but the animated line
# is drawn and saved in the pixel buffer background
background = None
def snap_background(self):
 global background
 background = canvas.copy_from_bbox(ax.bbox)
p.connect('draw_event', snap_background)
def update_line(*args):
 if background is None: return True
 # restore the clean slate background
 canvas.restore_region(background)
 # update the data
 line.set_ydata(nx.sin(x+update_line.cnt/10.0)) 
 # just draw the animated artist
 ax.draw_artist(line)
 # just redraw the axes rectangle
 canvas.blit(ax.bbox) 
 
 if update_line.cnt==50:
 # print the timing info and quit
 print 'FPS:' , 200/(time.time()-tstart)
 sys.exit()
 update_line.cnt += 1
 return True
update_line.cnt = 0
gobject.idle_add(update_line)
p.show()
From: Charles M. <cm...@in...> - 2005年08月04日 16:52:14
example/animation_blit.py works fine on my laptop, but for some reason not 
obvious to me it is not working on my desktop. Here is the error:
Traceback (most recent call last):
 File "animation_blit.py", line 30, in update_line
 ax.draw_artist(line)
 File "/usr/local/lib/python2.4/site-packages/matplotlib/axes.py", line 1336, 
in draw_artist
 assert self._cachedRenderer is not None
AssertionError
Both machines are up-to-date with cvs. Any clues?
Thanks,
	Charlie
John Hunter wrote:
> I wrote once before
> (http://sourceforge.net/mailarchive/message.php?msg_id=12093643) about
> some new methods for animation that can enable fast animations in
> matplotlib, which can support everything from dynamically updating
> your data to strip charts to real time cursoring to a widget like
> canvas.
> 
> So far, only GTKAgg has complete support for the required methods. I
> think it would be nice to have these in the major mpl GUI backends,
> since it would make the animation interface much simpler and cleaner
> if we could rely on them in the frontend, eg in the Axes class.
> 
> I just posted an entry on the wiki about matplotlib animations. It
> starts with regular "pylab" animations, and then discusses GUI
> animations using timers and event handlers, and finally the newfangled
> methods to support per-artist animations.
> 
> As it turns out, for the *Agg backends, only one new method needs to
> be added, which is 
> 
> canvas.blit(bbox)
> 
> This method transfers the agg canvas within the bounding box onto the
> GUI canvas. I realize that I need to add something like 
> 
> aggcanvas.as_rgba_str(bbox) 
> 
> to support this for Qt and WX which are currently using string methods
> to blit to canvas. I'm happy to do this in the next couple of days if
> I know that someone is interested in actually implementing
> canvas.blit(bbox) for their respective backend.
> 
> To see the utility of the new methods, run examples/widgets/cursor.py
> and examples/widgets/span_selector.py modified to set useblit=True,
> and compare the performance of anim.py with examples/animation_blit.py
> which animate the same data. All of the above should be run done with
> the GTKAgg backend.
> 
> As noted on the wiki entry, with these methods in place, users who
> want to do per artist animation could write code like
> 
> line, = ax.plot(something, animated=True)
> canvas.draw() 
> 
> def callback(*args):
> line.set_ydata(somedata)
> ax.draw_animated()
> 
> 
> This *doesn't* work now, because I am hesitant to put methods into
> Axes which would break most backends. The equivalent in
> animation_blit.py is considerably more complicated.
> 
> Perhaps someone at STScI could sign up for implementing
> canvas.blit(bbox) for TkAgg, and someone at JPL for the Qt backend? I
> might take a crack at WX, if noone else wants it :-) Steve, Gregory
> and Charles, if you are interested in animation for your respective
> backends, I encourage you to take a look at this too. Those of you
> using the agg buffer in extension code (eg tkagg) may want to look at
> src/_gtkagg.cpp to see how the bbox and the agg buffer are used to
> implement blit, which defaults to blitting the entire canvas if
> blit=None. 
> All of this is discussed in more depth at
> http://www.scipy.org/wikis/topical_software/Animations
> 
> Thanks!
> JDH
> 
> 
> -------------------------------------------------------
> SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
> from IBM. Find simple to follow Roadmaps, straightforward articles,
> informative Webcasts and more! Get everything you need to get up to
> speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
> _______________________________________________
> Matplotlib-devel mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
From: Darren D. <dd...@co...> - 2005年08月04日 01:29:52
On Wednesday 03 August 2005 09:02 pm, John Hunter wrote:
> >>>>> "Steve" == Steve Chaplin <ste...@ya...> writes:
>
> Steve> Its good that this fixes the problem, but I don't see why
> Steve> flipping an image upside down should also change its
> Steve> size. There's probably still a bug in there somewhere, but
> Steve> its not too important if the SVG images look correct now.
>
> That was a different bug, which I fixed too.
>
> Steve> The SVG backend is also useful for debugging because it
> Steve> gives you a text list of everything the frontend does. For
> Steve> example I can look at the output of './simple_plot.py
> Steve> -dSVG' and see that the frontend seems to have a bug where
> Steve> its drawing every tickline twice.
I reported this problem a while back when I was trying to implement 
draw_markers in backend_ps. Here is the link 
http://sourceforge.net/mailarchive/message.php?msg_id=11371925
-- 
Darren
From: John H. <jdh...@ac...> - 2005年08月04日 01:03:06
>>>>> "Steve" == Steve Chaplin <ste...@ya...> writes:
 Steve> Its good that this fixes the problem, but I don't see why
 Steve> flipping an image upside down should also change its
 Steve> size. There's probably still a bug in there somewhere, but
 Steve> its not too important if the SVG images look correct now.
That was a different bug, which I fixed too.
 Steve> The SVG backend is also useful for debugging because it
 Steve> gives you a text list of everything the frontend does. For
 Steve> example I can look at the output of './simple_plot.py
 Steve> -dSVG' and see that the frontend seems to have a bug where
 Steve> its drawing every tickline twice. I had a look at axis.py
 Steve> but could not work out what was going on.
Interesting. I've heard of this once before. I'll see if I can find
it.
JDH
From: Steve C. <ste...@ya...> - 2005年08月04日 00:25:24
On Wed, 2005年08月03日 at 10:27 -0500, John Hunter wrote:
> >>>>> "Steve" == Steve Chaplin <ste...@ya...> writes:
> 
> Steve> One problem with the colorbar is that the png file
> Steve> "im.write_png (filename)" creates is upside down,
> Steve> image_demo.py creates an upside down png too.
> 
> 
> Steve> I see that the GTK/GDK backend does not use im.write_png()
> Steve> but uses im.as_str() which has a 'flipud' argument to flip
> Steve> the image. Is it possible for im.write_png() to take the
> Steve> 'flipud' argument and flip the image for the SVG backend?
> 
> I started working on this, but then realized I would also need to add
> it to buffer_argb32, buffer_rgba and so on, and that is was much
> cleaner to simply add an im.flipud() method than implement it in all
> the conversion and write methods.
> 
> I just committed changes with these fixes and updated backend_ps and
> backend_svg to use them. images in svg appear to be working fine now,
> and the origin = 'lower'|'upper' is respected.
> 
> Steve> The name im.as_str() is a bit vague - what kind of string?
> Steve> Something like im.as_rgba_str() would make it a bit
> Steve> clearer.
> 
> Done.
> 
> JDH
Its good that this fixes the problem, but I don't see why flipping an
image upside down should also change its size. There's probably still a
bug in there somewhere, but its not too important if the SVG images look
correct now.
The SVG backend is also useful for debugging because it gives you a text
list of everything the frontend does. For example I can look at the
output of './simple_plot.py -dSVG' and see that the frontend seems to
have a bug where its drawing every tickline twice. I had a look at
axis.py but could not work out what was going on.
Steve
Send instant messages to your online friends http://au.messenger.yahoo.com 

Showing 9 results of 9

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 によって変換されたページ (->オリジナル) /