if at renderer or at artist level. The rulers must follow
> the mouse and everytime they are moved the contents
> "below" them must be restored. I don't know how to do it
> (to save the underlying contents before rendering the
> ruler). Another matter is tranformation between data and
> screen coordinates, how could I do it? I played a little
> with events, line artist and with the renderer api but I
> would welcome any clue from you.
matplotlib has very recently added the ability to do just what you
describe (save and restore a background region, selectively draw
certain artists). The details of this are discussed at the matplotlib
Fortunately for you, there is already an Cursor class which uses these
new techniques; See examples/widgets/cursor.py in the last matplotlib
release which uses the Cursor class at
http://matplotlib.sf.net/matplotlib.widgets.html#Cursor. I suggest
studying the source code for the Cursor class in matplotlib.widgets.py
since it implements exactly what you describe and thus will serve as
a good example for you if you want to understand animation further.
There are two modes in the Cursor class: useblit=True and
useblit=False. The former uses the copy/restore region feature you
describe for fast animated drawing and is available in the GTKAgg
backend in the last matplotlib release and in TkAgg in matplotlib CVS.
With useblit=False, cursoring will work but will be slower. Let me
know which backend/GUI you plan to be using.
The other alternative is to use GUI native drawing on top of the
matplotlib FigureCanvas; for the wx backend, there is an example
illustrating this in examples/wxcursor_demo.py.