Connect two TAxis ranges


I have a situation where I have two histograms that I would like to ensure always have the same axis range. I admit that whenever I change the axis range of one, I could just update the axis range of the other. But it would be nice if there is a way to do this automatically. Is there a “Event” that I can listen for for when the axis range changes? I would like this to be triggered both on code-based range changes (direct calls to SetRange/SetRangeUser) or via the GUI if I select a range that way.


See [url]Retrieve a TAxis object from a TCanvas


Sorry, but that link appears to be related to an entirely separate problem. I guess I didn’t explain myself well enough. Let me set up an example:

I have two histograms, and I draw one to one TPad, and I draw the other one to a completely different TPad. If I then click on the x-axis of one of the histograms so that I change its range, how do I make it so that the other histogram is automatically updated with a matching range?

I think you have to use: