繋がったの星の絆、いつまでも守よ

ROOT画多条曲线图的方法

root [0] TMultiGraph *mg = new TMultiGraph();

root [1] 

root [1]    const Int\_t n1 = 12;

root [2]    Double\_t x1[] = {-1.0,2.0,5.0,8.0,11.0,14.0,17.0,20.0,23.0,26.0,29.0,30.0};

root [3]    Double\_t y1[] = {0.0,13.2,21.3,29.5,36.6,41.7,46.6,50.8,53.3,57.3,58.7,60.7};

root [4]    auto gr1 = new TGraphErrors(n1,x1,y1);

root [5]    gr1->SetMarkerStyle(22);

root [6]    gr1->SetMarkerColor(kBlack);

root [7]    mg->Add(gr1);

root [8] 

root [8]    const Int\_t n2 = 12;

root [9]    Float\_t x2[] = {-0.5,2.5,5.5,8.5,11.5,14.5,17.5,20.5,23.5,26.5,29.5,30.0};

root [10]    Float\_t y2[] = {0.0,8.6,13.1,16.6,19.5,21.8,23.5,24.7,26.1,27.6,27.8,28.0};

root [11]    auto gr2 = new TGraphErrors(n2,x2,y2);

root [12]    gr2->SetMarkerColor(kBlack);

root [13]    gr2->SetMarkerStyle(20);

root [14]    mg->Add(gr2);

root [15] 

root [15]    mg->Draw("APL");

Info in <TCanvas::MakeDefCanvas>:  created default TCanvas with name c1

root [16] 

出折线图Draw填APL,出散点图填AP,出圆滑曲线AC,我找到TGraphPainter的说明了:TGraphPainter Class Reference

然后只画一条曲线的你看一下我之前的这篇

需要fit的看官方文档_(:зゝ∠)_然后可能要结合WJ学长发的北大那个PPT,找一样的图就行,北大那个写开头,然后内容复制官方文档里面的,能出图……

人生追求已经变成能出图就行了……

<
评论系统不需要注册,对文章有任何意见或建议,请务必留下评论~
Comments
Write a Comment