Good day!
I have a lot of data files and I want to plot it on the same canvas. This function work pretty well, but unfortunately it can’t change the graph Line Color. So I have all graphs with the same color.
How I can fix this problem?
`void Plot_Gr()
{
char fileStr[20];
TCanvas *c1 = new TCanvas();
TGraph *gr = new TGraph();
for (int fileName = 0; fileName < 20; fileName++)
{
gr->SetMarkerStyle(fileName);
gr->SetLineColor(fileName);
fstream file;
sprintf(fileStr, "%d.txt", fileName);
file.open(fileStr, ios::in);
while (1)
{
double x, y;
file >> x >> y;
gr->SetPoint(gr->GetN(), x, y);
if(file.eof())
break;
}
file.close();
gr->Draw("APL");
}
}`
ROOT Version: 6.18/04
Platform: ubuntu_21.04
Compiler: gcc
