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.
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
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
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
Thank you, that's much easier than the animation option, which would
be more than I need to do.
Che
···
On Tue, Feb 16, 2010 at 12:37 PM, John Hunter <jdh2358@...287...> wrote:
On Tue, Feb 16, 2010 at 11:14 AM, C M <cmpython@...287...> 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