Set maximum of multigraph

Hi

I have a multigraph to which I add many TGraphs with a mouse click. each time I add a new graph the multigraph rescales to the actual graph. Therefore, if the maximum y-value of the new graph is much smaller, the other graphs almost disapear into the upper part of the y-axis.
How can I determine the maximum of all maxima of each TGraph the multigraph contains and then appropriately rescale the multigraph?

Cheers,
delos

Really ? how ?

You better write a macro…

A multigraph always show all the graphs it contains. the min and max blues are computed as the min of all the min and max of all the max .

Ok, the user add the graphs by pushing a button with the mouse :wink:

The script reads files creats TGraphs and adds them to a multigraph.
As you can see on the picture the scale is set to the last graph loaded, in this case the one with the smallest maximum (the blue one).

Cheers,
delos


very likely:

gPad->Modified()
gPad->Update()

is needed for this pad

I did.

Is there no way to determine the maximum of all graphs in a multiplot?

Thanks,
delos

As I said the Multigraph does it itself each time you draw it … you have nothing to do … Something should be wrong in your code … what happens if you try to change the graphics window size with the mouse ? does it update the plots ?

Actually, I set the pad no editable after I added graphs and updated the canvas. But I tried and the graphs indeed rescale.
What I would like is, that the user can only change the scale with the mouse (zoom in or out) but not enlarge it or accidantly move the pad/the graph around. What usually happens is that people click into the graphs and everything is messed up.
So half of the problem is solved when I change the order of setting editable, updating, adding aso.
Still I would be interested to find the maximum of all graphs. I guess I have to go through all of them.

Thanks,
delos

mg->GetHistogram()->GetMaximum();

Perfect, thank you.
I did’t find it because I was not looking at “histogram”. I should have read the doc more closely.

Cheers,
delos