How to set range on in a pad?

Hi,

I’m plotting two TGraphErrors in the same pad. The first graph has range 0. to 80., the second one has got a range from 80. to 200. . I use the following code:

[code] TCanvas *average_ratios = new TCanvas(“average_ratios”,“average_ratios”,1);
average_ratios->Divide(2,1);
average_ratios->cd(1);
gPad->RangeAxis(0., 0., 200., 1.);

…(graph 1 settings)…
plus_graph_1->Draw(“AP”);

…(graph 2 settings)…
plus_graph_2->Draw(“sameP”);[/code]
The resulting plot only shows the range of the first graph: 0. to 80. . I already googled my problem and tried to solve it by explicitely creating a TPad but without result.

Use TMultiGraph to compute the global range.
root.cern.ch/root/html/TMultiGraph.html

1 Like

It works! Thank you for the advice.