I have a PyROOT function which accomplishes the X-axis rescaling, you could re-write it in C++ (basically add curly braces and types).
def rescaleaxis(g,scale=50e-12/1e-9):
"""This function rescales the x-axis on a TGraph."""
N = g.GetN()
x = g.GetX()
for i in range(N):
x[i] *= scale
g.GetHistogram().Delete()
g.SetHistogram(0)
return
Here are some references on how I obtained that code:
[url]Feature Request: Transform TAxes
root.cern.ch/phpBB3/viewtopic.php?f=3&t=15953
For the Y-axis, I think you can do the same thing but with GetY(). I tried doing another trick by converting to a TH1, TH1::Scale, then converting back to TGraph, but it didn’t work for some reason. I’ll admit I didn’t try very hard to make this trick work.
Jean-François