Home | News | Documentation | Download

Reverse Axis for TGraph and Fit

@couet TGraphPainter has a baked in option for reversing x and y axes. I’m struggling to get TObjects (like my fit, or various lines/boxes) to match the reversed axes.

TGraphErrors *g = new TGraphErrors(n,x,y,ex,ey);
g->Draw("ALP RX");
g->Fit("pol1");

the above code will produce the TGraph reversed, but the fit with the original axes.

I have a more detailed Macro with data below
Forum_Macro.C (913 Bytes)
EfficiencyResults.root (34.6 KB)


Please read tips for efficient and successful posting and posting code

ROOT Version: 6.18/04
Platform: MacOS v10.15.5
Compiler: Not Provided


Here we are.

usccaa.C (1.3 KB)

Dear all,
what should I do to flip the y-axis in the case of a TGraph2D, please?
I have tried:

TGraph2D gr("potential.txt");
gr.Draw("colz RY");

But the y axis is not flipped
potential.txt (134.5 KB)
potential.pdf (19.2 KB)
I am using ROOT 6.18/04

Many thanks in advance and kind regards,
Marco Bomben

This is not possible for TGraph2D

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