preventing scaling view after updating plot

(mpl 0.98.5 OO embedded in wx)

Hi, I'm trying to highlight a picked datapoint, such as is shown in
this thread:

http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg05580.html

As John suggested there, I get the index of the picked point, and then
plot a marker on that point. I am using the OO mpl form, so then
I call, to draw this new point on the canvas:

self.canvas.draw()
(self.canvas is a figure.canvas object).

But when I do this it *rescales the plot*, which I don't want. In this thread:

http://www.nabble.com/Re%3A-Plotting-single-marker-point-at-zoomed-level-p17511209.html

I found someone mentioning this concern. He said:

Thanks for that, the canvas.draw() function redraws the graph.
I had to add the "autoscale_on=False" to the add_subplot()
to stop the graph from autoscaling.

I tried this, and it did stop autoscaling--but I do want y autoscaling.
What I want is y autoscaling but not y autoscaling (just setting xlims).
I tried adding either of these lines right before or right after when I plotted
the highlighted point:

self.subplot.set_autoscale_on(False)
self.subplot.autoscale_view(tight=False, scalex=False, scaley=True)

and it didn't help--the plot rescaled, both x and y.

Any ideas what I'm doing wrong?

Thanks,
Che

I tried this, and it did stop autoscaling--but I do want y autoscaling.
What I want is y autoscaling but not y autoscaling (just setting xlims).
I tried adding either of these lines right before or right after when I plotted
the highlighted point:

Just to be clearer: What I want is the plot to stay precisely the same
when I add the highlighted point. But now I have either of two undesired
alternatives:

1) I do add_subplot(111,autoscale_on=False) when I create the
subplot and none of my plots have the y scaled (but I want them scaled).

2) I do add_subplot(111) and when I add a highlighted datapoint it
autoscales my plot (but I don't want that).

Thanks,
Che

If you upgrade to SVN head, it supports what you want. You can use:

add_subplot(111, autoscalex_on=False)

I don’t think this particular feature has made it into a release yet.

Ryan

···

On Thu, Apr 9, 2009 at 1:04 AM, C M <cmpython@…287…> wrote:

I tried this, and it did stop autoscaling–but I do want y autoscaling.

What I want is y autoscaling but not y autoscaling (just setting xlims).

I tried adding either of these lines right before or right after when I plotted

the highlighted point:

Just to be clearer: What I want is the plot to stay precisely the same

when I add the highlighted point. But now I have either of two undesired

alternatives:

  1. I do add_subplot(111,autoscale_on=False) when I create the

subplot and none of my plots have the y scaled (but I want them scaled).

  1. I do add_subplot(111) and when I add a highlighted datapoint it

autoscales my plot (but I don’t want that).


Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma

Wow, thanks Ryan. This is the beauty of an email list. I'll try to
get it from SVN or back-burner this issue until the next release.

Che

···

On Thu, Apr 9, 2009 at 9:25 AM, Ryan May <rmay31@...287...> wrote:

On Thu, Apr 9, 2009 at 1:04 AM, C M <cmpython@...287...> wrote:

>
> I tried this, and it did stop autoscaling--but I do want y autoscaling.
> What I want is y autoscaling but not y autoscaling (just setting xlims).
> I tried adding either of these lines right before or right after when I
> plotted
> the highlighted point:

Just to be clearer: What I want is the plot to stay precisely the same
when I add the highlighted point. But now I have either of two undesired
alternatives:

1) I do add_subplot(111,autoscale_on=False) when I create the
subplot and none of my plots have the y scaled (but I want them scaled).

2) I do add_subplot(111) and when I add a highlighted datapoint it
autoscales my plot (but I don't want that).

If you upgrade to SVN head, it supports what you want. You can use:

add_subplot(111, autoscalex_on=False)

I don't think this particular feature has made it into a release yet.

Ryan
--
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma