Hey everyone,

I'm making a data analysis suite in python, and want to construct a custom event handler which will reset the axis based on the data in the current subplot. To do so, I need the event handler to know what data is currently in the subplot. The matplotlib Axes and Axis classes are good at telling you the data limits in the entire plot, but not when the plot is zoomed in.

So for example, if my data runs from -100,100 on the x-axis, and I zoom into a window of -50,50, I need a command that will return the subset of the data within these boundaries. Then I can redraw the plot so that it effectively has the same width of the data curves. Essentially, this will autoscale the axis to optimally view the data.

I can't seem to find anything like this, and was going to try to write a custom routine to do this, but wanted to make sure no one knew of one already.


6 Years
Discussion Span
Last Post by hughesadam_87
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.