On Tue, Feb 16, 2010 at 11:14 AM, C M <cmpyt...@gmail.com> wrote:
> I have a mpl graph embedded in wxPython, and I call a function,
> customize_plot() to do a number of things to the plot:  adjust the
> spacing around it, set the formatters, fontsizes, axis limits, set a
> grid, etc.
>
> Now I want to potentially highlight points (by adding semi-transparent
> points on top of existing ones) or annotate points with user
> interaction.  If I do that, it seems I need to call canvas.draw().
> But when I do that, it redraws the whole canvas and ignores some of
> the formatting I laid out in customize_plot(), specifically the view
> limits, and that's not acceptable.

This isn't accurate -- calling draw will not change the view limits.
In all likelihood what is happening is that when you add you your
overlay markers, eg by calling "plot" the view limits are getting
updated.  You can suppress this with

ax.set_autoscale_on(False)
ax.plot(overlay_markers)
fig.canvas.draw()


> I want it to simply add the new points without changing any of the
> features of the plot.  Is there a way to do that?  In Googling for
> hints, I found this point from JDH from almost two years ago, which I
> think is applicable to my need:
>
>> If you call fig.canvas.draw, everything will be updated.  If you want
>> to selectively draw certain artists, you can use the animated property
>> w/ background copy/restore and the draw_artist method as described at
>
>> http://www.scipy.org/Cookbook/Matplotlib/Animations
>
> Is this still the case in the current version of matplotlib?  Or is
> there a newer way to do it now?

Yes, this is still accurate, and can be use for more efficient
updating, but it is unrelated to the problem with the view limits you
described.

JDH

------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to