数据:

data.txt

3 57.6
6 41.9
9 31.0
12 22.7
15 16.6
18 12.2
21 8.9
24 6.5

代码:

void a()
{
    TCanvas *c = new TCanvas("c1", "Data Analysis", 500, 500);
    TGraph* gr = new TGraph("data.txt"); // 数据
    gr->SetMarkerStyle(2);
    gr->SetMarkerSize(2);
    gr->SetMarkerColor(2);
    gr->Draw("AP");
}
Last modification:April 19th, 2020 at 07:58 pm
如果觉得我的文章对你有用,请随意赞赏