Drawing multiple TGraph from two txt file

Dear Expert,

I want to add two TGraph from two txt file in a TMultiGraph and draw it.
But I am facing below error:

This is script attached that I am using read_graph_txt_MC_data.C (2.1 KB)

mean_variation.txt (667 Bytes)

mean_variation_new_single_gauss.txt (662 Bytes)

Can you please suggest ?

Regards
Chanchal


Please read tips for efficient and successful posting and posting code

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided


mg.Add(&graph1);

It’s working now. Thanks a lot for your reply.

Hii @Wile_E_Coyote,

I want to set the range of x axis from 0 to 2.5 of a this TMultiGraph. I have tried this using mg.GetXaxis()->SetRangeUser(0, 2.5); but its taking range according with data points below.

image

Can you please suggest to solve this?

Regards
Chanchal

Try: mg.GetHistogram()->GetXaxis()->SetRangeUser(0., 2.5);

Hii @Wile_E_Coyote,

Thanks for your reply.
This is giving the same as earlier.

Here the script and txt file that I am using (in case you prefer): read_graph_txt_MC_data.C (2.5 KB)
mean_variation_new_single_gauss.txt (662 Bytes)
mean_variation.txt (667 Bytes)

Regards
Chanchal

It seems you want to “widen” the axis, so try:
mg.GetHistogram()->GetXaxis()->SetLimits(0., 2.5);

It’s working now. Thanks a lot.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.