TGraph and Scale()?

Dear list,
i’m using the TGraph

TGraph(const char* filename, const char* format = "%lg %lg", Option_t* option = "")
method to read data directly from file. Maybe this a stupid question, bt I was wondering if TGraph allows to operate a rescaling of the data by a constant value in a way similar to the Scale() method of TH1. Is there something similar? Otherwise i have to modify directly the data on file.

With my best regards,
Marco

1 Like

You can make an operation on the data in memory, eg to multiply the Y values by a constant, do

for (int i=0;i<g.GetN();i++) g.GetY()[i] *= constant;
Rene

2 Likes

Dear Rene,
thanks a lot for your reply. This solved the question.

Regards,
marco

See https://github.com/root-project/root/pull/8143