I'm using a chaco scatter plot with a PanTool and a ZoomTool. After interacting with the plot via panning and zooming, I'd like to have a button to reset the plot to its default state, basically like the matplotlib home button. I've searched through the documentation and explored many methods and parameters of chaco.plot.Plot and chaco.axis.PlotAxis but haven't been able to figure this out.
Found a workable approach. First, after setting the plot data and creating the plot, cache the axis low and high values like so:
# cache default axes limits
x_lo = plot.x_axis.mapper.range.low
x_hi = plot.x_axis.mapper.range.high
y_lo = plot.y_axis.mapper.range.low
y_hi = plot.y_axis.mapper.range.high
After the user manipulates the plot, with PanTool and ZoomTool for example, the axes can be reset like so:
# reset plot to original form
plot.x_axis.mapper.range.set(low=x_lo, high=x_hi)
plot.y_axis.mapper.range.set(low=y_lo, high=y_hi)