I’m doing a pretty easy task, but I can’t find a simple way to do this.
I want to plot only a part of a txt file, which looks like:
#First part
2 1.96E-02
4 2.57E-02
12 2.81E-02
20 3.12E-02
28 3.17E-02
35 3.19E-02
#Second part
30 3.16E-02
28 3.19E-02
34 3.22E-02
31 3.17E-02
For the moment the only solution I found was to split the file in two (part_1.txt, part_2.txt) and the do:
TCanvas *c1 = new TCanvas("c1");
c1->Divide(1,2);
c1->cd(1);
TGraphErrors *gr1 = new TGraphErrors("part_1.txt","%lg %lg");
gr1->SetMarkerColor(kRed);
gr1->SetMarkerStyle(20);
gr1->Draw("AP");
c1->cd(2);
TGraphErrors *gr2 = new TGraphErrors("part_2.txt","%lg %lg");
gr2->SetMarkerColor(kBlue);
gr2->SetMarkerStyle(20);
gr2->Draw("AP");
which looks like my desired result.
Is there a way to read (or plot) olny a part of a txt file, maybe using the range of rows?