plotting directly using the renderer

Hello everyone,
Hello John,

thank you very much for your example - it is really fantastic. This was
exactly what I meant.

When I was trying to rewrite your code to a 'fastplot()'-command (which
would just be able to plot one point at a time) it worked quite well with
the Circle()-command you used. But is there a possibility to write the
'fastplot' in a way so that it can be used like
  fastplot(x,y, marker='s', color='g',markersize = 3)?

In the example given below the color is not recognized correctly. Do I use
Line2D in a wrong way?

A second question aims on the running-behavior: It - well - stumbles a
little bit. If you add a
  print i
to the for-loop you can see that the counting is done very smoothly. But the
plot isn't (at least at my computer - maybe this is already the answer).

Once again: Thanks!



"""A try to enable a fastplot() command"""

def fastplot_points(*args, **kwargs):
    """This program tries to enable a routine 'fastplot'
       based on JDH's code doing blit only in a small region
       around the new object.
       Notice: args have to be (x, y) and not ([x], [y]) like for plot().
               x,y are floats - not vectors!

    from matplotlib.lines import Line2D
    from matplotlib.transforms import identity_transform, lbwh_to_bbox

    ax = gca()
    trans = identity_transform()
    trans.set_offset( args, ax.transData)
    line = Line2D([0],[0], transform=trans, **kwargs)
    l,b,w,h = line.get_window_extent(ax.get_renderer_cache()).get_bounds()
    pad = 3
    bbox = lbwh_to_bbox(l-pad, b-pad, w+2*pad, h+2*pad)

from pylab import *
import time


subplot(111, autoscale_on=False)
tstart = time.time()
title('point by point with blitting')
print " fastplot every point seperately ... "
draw() # necessary to get renderer
for i in xrange(n): # plot all data step by step
    fastplot_points( x[i], y[i],marker='s',color='r')

tend = time.time()
print 'It took %4.2f s.'%(tend - tstart)

Lust, ein paar Euro nebenbei zu verdienen? Ohne Kosten, ohne Risiko!
Satte Provisionen f�r GMX Partner: