Most likely, the program isn't really going back to the "original" axes as much that it is automatically setting the axes to fit all the data from the new plot (which would likely be the "original axes", but only by coincidence).  I am sure there is some sort of easy way to do this, but the brute-force way would be for any action to create a plot to first check and see what the current x and y lims are and save them to temporary variables.  Then, after creating the plots, call set the x and y lims from the temporary variables.

Note that there might be an issue with the first graph, because you don't want to set the axes after creating the graph using the information prior to the graphing.  I don't know how one would detect that, besides some sort of counter and an if-statement.

Maybe someone else has a better way?

Ben Root

On Tue, Jun 22, 2010 at 8:56 PM, Stephen George <> wrote:


I have an application that draws a line plot of  a spectrum. When the
spectrum is collected different gains and filters may be used for each
data point (which I have also collected). I am looking at artefacts in
the spectrum and trying to correlate them with things such as the gain
and filter changes etc.

On the application I have a number of radio buttons, when clicked will
add a scatter plot of the datapoints but color coded by the item of
click the gain btn  I end up with the line plot, and each data point has
a color coded dot whose color is keyed to the gain the data point was
taken at.
click the filter btn  I remove the gain scatter plot, and add a filter
scatter plot where each data point is color coded with the filter used.

This functionality work fine.

However if I am zoomed in on my graph looking at detail, then click the
radio button, the scatter plot forces the graph to resize to once again
show the overall intial view (zoomed out).

I am wondering how can I add the scatter plot, without changing the
current view (zoom level) that I am currently using, but still add all
the scatter plot data?

Any suggestions gratefully accepted.


ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit.  See the prize list and enter to win:
Matplotlib-users mailing list