当前位置: 首页>>代码示例>>C++>>正文


C++ TGraph::GetXaxis方法代码示例

本文整理汇总了C++中TGraph::GetXaxis方法的典型用法代码示例。如果您正苦于以下问题:C++ TGraph::GetXaxis方法的具体用法?C++ TGraph::GetXaxis怎么用?C++ TGraph::GetXaxis使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TGraph的用法示例。


在下文中一共展示了TGraph::GetXaxis方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: TGraph

TGraph *graphLH(std::string nuisname, double err ){

	w->loadSnapshot("bestfitall"); // SetTo BestFit values as start

	// Get The parameter we want 
	RooRealVar *nuis =(RooRealVar*) w->var(nuisname.c_str());
	double bf = nuis->getVal();
	double nll_0=nll->getVal();


	TGraph *gr = new TGraph(2*npoints+1);
	for (int i=-1*npoints;i<=npoints;i++){
		nuis->setVal(bf+err*( ((float)i)*nsigma/npoints));
		double nll_v = nll->getVal();
		gr->SetPoint(i+npoints,nuis->getVal(),nll_v-nll_0);
	}

	gr->SetTitle("");
	gr->GetYaxis()->SetTitle("NLL - obs data");
	gr->GetYaxis()->SetTitleOffset(1.1);
	gr->GetXaxis()->SetTitleSize(0.05);
	gr->GetYaxis()->SetTitleSize(0.05);
	gr->GetXaxis()->SetTitle(nuisname.c_str());
	gr->SetLineColor(4);
	gr->SetLineWidth(2);
	gr->SetMarkerStyle(21);
	gr->SetMarkerSize(0.6);
	
	return gr;
	
}
开发者ID:ajgilbert,项目名称:combine-scripts,代码行数:31,代码来源:checkBestFitPoint.C

示例2: SetTitle

void SetTitle(TGraph& g, TString Xtitle, TString Ytitle, TString title){
	g.GetXaxis()->SetTitle(Xtitle);
	g.GetYaxis()->SetTitle(Ytitle);
	g.GetXaxis()->CenterTitle();
	g.GetYaxis()->CenterTitle();
	g.SetTitle(title);
}
开发者ID:XuQiao,项目名称:phenix,代码行数:7,代码来源:SimplifyLife.C

示例3: SetStyle

void SetStyle(TGraph& g, double size, int color, int style, int fillstyle=0, int linestyle=1){
	g.SetMarkerSize(size);
	g.SetMarkerColor(color);
	g.SetLineColor(color);
	g.SetMarkerStyle(style);
	g.SetFillStyle(fillstyle);
	g.SetLineStyle(linestyle);
	g.GetXaxis()->SetTitleFont(42);
	g.GetYaxis()->SetTitleFont(42);
	g.GetXaxis()->SetTitleSize(0.048);
	g.GetYaxis()->SetTitleSize(0.048);
	g.GetXaxis()->CenterTitle();
	g.GetYaxis()->CenterTitle();
}
开发者ID:XuQiao,项目名称:phenix,代码行数:14,代码来源:SimplifyLife.C

示例4: graph

void graph() {
   TCanvas *c1 = new TCanvas("c1","A Simple Graph Example",200,10,700,500);

   c1->SetFillColor(42);
   c1->SetGrid();

   const Int_t n = 20;
   Double_t x[n], y[n];
   for (Int_t i=0;i<n;i++) {
     x[i] = i*0.1;
     y[i] = 10*sin(x[i]+0.2);
     printf(" i %i %f %f \n",i,x[i],y[i]);
   }
   TGraph *gr = new TGraph(n,x,y);
   gr->SetLineColor(2);
   gr->SetLineWidth(4);
   gr->SetMarkerColor(4);
   gr->SetMarkerStyle(21);
   gr->SetTitle("a simple graph");
   gr->GetXaxis()->SetTitle("X title");
   gr->GetYaxis()->SetTitle("Y title");
   gr->Draw("ACP");

   // TCanvas::Update() draws the frame, after which one can change it
   c1->Update();
   c1->GetFrame()->SetFillColor(21);
   c1->GetFrame()->SetBorderSize(12);
   c1->Modified();
}
开发者ID:bbannier,项目名称:root-1,代码行数:29,代码来源:graph.C

示例5: treegraph

void treegraph(TString filename) {
   gROOT->SetStyle("Plain");
   gStyle->SetOptDate();


   Double_t x, y;
   Int_t nlines = 0;
   TFile *f = new TFile("graph.root","RECREATE");

   TCanvas *canvas_graph = new TCanvas("canvas_graph", "y vs x",467,89,400,700);

   TTree t;
   t.ReadFile(filename,"x:y");
   t.Draw("x:y","","goff");

   TGraph *g = new TGraph(t.GetSelectedRows(),t.GetV1(),t.GetV2());
   g->SetTitle(filename+": Y vs X");
   g->GetXaxis()->SetTitle("x[a.u.]");
   g->GetYaxis()->SetTitle("y[a.u.]");

   g->SetMarkerStyle(21);
   g->Draw("AP");

   f->Write();
}
开发者ID:bdorney,项目名称:TurboSoftware,代码行数:25,代码来源:treegraph.C

示例6: testing

void testing() { //new
   TCanvas *c1 = new TCanvas("c1","A Simple Graph Example",200,10,700,500);
   c1->SetFillColor(42);
   c1->SetGrid();
   
   const int n = 20;
   double x[n], y[n];
   for (int i=0;i<n;i++) {
      x[i] = i;
      y[i] = 2*i;
      cout<<x[i]<<"\t"<<y[i]<<endl;
   }
   
   TGraph *gr = new TGraph(n,x,y);
   gr->SetLineColor(2);
   gr->SetLineWidth(4);
   gr->SetMarkerColor(4);
   gr->SetMarkerStyle(21);
   gr->SetTitle("a simple graph");
   gr->GetXaxis()->SetTitle("X title");
   gr->GetYaxis()->SetTitle("Y title");
   gr->Draw("ACP");
   
   c1->Update();
   c1->Modified();
   c1->Connect("Closed()", "TApplication", gApplication, "Terminate()"); //new
}
开发者ID:alicerobson,项目名称:fastsim_cc,代码行数:27,代码来源:main.cpp

示例7: title

//Return a graph of the llscan
TGraph * LLscanResult::GetGraph() 
{
	double*  pvs = new double[parameterValues.size()] ;
	double* llvs = new double[parameterValues.size()] ;
	double llmax = 0 ;	
	for(unsigned int i=0; i< parameterValues.size() ; ++i ){
		pvs[i] = parameterValues[i] ;
		llvs[i] = llvalues_offset[i] ;
		if( llvs[i] > llmax ) llmax = llvs[i] ;
	}	

	TGraph* gr = new TGraph( Int_t(parameterValues.size()), pvs, llvs ) ;
	//gr->SetTitle("LL Scan for Parameter xxx");	
	gr->SetMarkerStyle(1);
	gr->SetLineWidth(2);
	gr->SetMarkerColor(4);
	gr->SetLineColor(4);
	gr->GetYaxis()->SetRangeUser( 0., llmax*1.2 );
	gr->GetYaxis()->SetLimits( 0., llmax*1.2 );
	gr->SetMinimum( 0.0 );
	gr->SetMaximum( llmax*1.2 );
	gr->Draw("ALP");
	string title("LL Scan for Parameter ") ;
	title+=parameterName.c_str();
	gr->SetTitle(title.c_str());	
	gr->GetXaxis()->SetTitle(parameterName.c_str());

	return gr ;
}
开发者ID:abmorris,项目名称:RapidFit,代码行数:30,代码来源:LLscanResult.cpp

示例8: particleinteractions2

void particleinteractions2() {
  //Draw a simple graph
  // To see the output of this macro, click begin_html <a href="gif/graph.gif">here</a>. end_html
  //Author: Rene Brun

  TCanvas *c1 = new TCanvas("c1","A Simple Graph Example",200,10,700,500);

  c1->SetFillColor(42);
  c1->SetGrid();

  const Int_t n = 1000;
  Double_t x[n], y[n];
  int minEnergy = ceil(mass*pow(c,2));
  for (Int_t i=0; i < 1000;i++) {
    double  energy = minEnergy+i;
    x[i] = energy;
    y[i] = exp(-mass*c/(lifetime*sqrt(energy*energy-mass*mass*pow(c, 4))));
    printf(" i %i %f %f \n",i,x[i],y[i]);
  }
  TGraph *gr = new TGraph(n,x,y);
  gr->SetLineColor(2);
  gr->SetLineWidth(4);
  gr->SetMarkerColor(4);
  gr->SetMarkerStyle(21);
  gr->SetTitle("Particle Decay Graph");
  gr->GetXaxis()->SetTitle("Energy (MeV)");
  gr->GetYaxis()->SetTitle("Probability");
  gr->Draw("ACP");

  // TCanvas::Update() draws the frame, after which one can change it
  c1->Update();
  c1->GetFrame()->SetFillColor(21);
  c1->GetFrame()->SetBorderSize(12);
  c1->Modified();
}
开发者ID:eshantewari,项目名称:UMD2015,代码行数:35,代码来源:particleinteractions2.C

示例9: makeOBV

TGraph * makeOBV(TGraph *Graph1){

	TGraph *gr = new TGraph();
	double X;
	double Y;
	int pp=0;
	Graph1->GetPoint(1,X,Y);
	for (double MDM=1;MDM<=Y;MDM+=0.1){

		gr->SetPoint(pp,MDM,vecF(X,MDM));
		pp++;
	}
	for (int p =1;p<Graph1->GetN();p++){
		Graph1->GetPoint(p,X,Y);
		if (!(X >1)) continue;
		
		std::cout << X << "  " << Y << std::endl;
		gr->SetPoint(pp,Y,vecF(X,Y));	
		pp++;
	}
	gr->GetXaxis()->SetTitle("m_{DM}");
	gr->GetYaxis()->SetTitle("#sigma_{SD}");
	gr->SetName(Form("%s_DD",Graph1->GetName()));
	gr->SetLineStyle(Graph1->GetLineStyle());
	gr->SetLineColor(Graph1->GetLineColor());
	gr->SetLineWidth(Graph1->GetLineWidth());

	return gr;	
}
开发者ID:nucleosynthesis,项目名称:EXOpaper,代码行数:29,代码来源:buildPlotAxial_DD.C

示例10: plotChi2

void plotChi2(TTree *dataTree, TTree *mcTree,
	      TCut dataCandidateCut, TCut sidebandCut,
	      TCut mcSignalCut,
	      Double_t backgroundShift, Double_t purityBinVal)
{
  dtree_ = dataTree;
  mtree_ = mcTree;
  dCut_ = dataCandidateCut;
  sCut_ = sidebandCut;
  mCut_ = mcSignalCut;
  bkg_shift_ = backgroundShift;
  purityBinVal_ = purityBinVal;

  const int bins = 100;//0.001/0.00001;
  double x[bins];
  double y[bins];
  
  for(int i = 0; i < bins; i++)
  {
    double shift = -0.0005 + 0.001 * ((double)i/bins);
    x[i] = shift;
    y[i] = minimizerPurity(shift);    
  }

  TGraph *plot = new TGraph(bins,x,y);
  plot->GetYaxis()->SetTitle("#chi^2/ndf");
  plot->GetXaxis()->SetTitle("signal distribution shift");
  plot->Draw("AP");
}
开发者ID:CmsHI,项目名称:gammaJetAnalysis,代码行数:29,代码来源:photonChi2Min.C

示例11: draw_axis_lambda

void draw_axis_lambda(const char *opt = "")
{
    const Int_t nn = 2;
    Double_t xx[nn] = {LAMBDA_MIN, LAMBDA_MAX};
    Double_t yy[nn] = {LAMBDA_INT_MIN, LAMBDA_INT_MAX};
    TGraph *ga = new TGraph(nn, xx, yy);
    ga->SetTitle(Form("Intensity (Lambda) %s", opt));
    ga->GetXaxis()->SetTitle("Lambda");
    ga->GetYaxis()->SetTitle("Intensity");
    ga->Draw("ap");
}
开发者ID:akusumoto,项目名称:root-tomoyori-bragg,代码行数:11,代码来源:compare_integration.C

示例12: draw_axis_tof

void draw_axis_tof(const char *opt = "")
{
    const Int_t nn = 2;
    Double_t xx[nn] = {TOF_MIN, TOF_MAX};
    Double_t yy[nn] = {TOF_INT_MIN, TOF_INT_MAX};
    TGraph *ga = new TGraph(nn, xx, yy);
    ga->SetTitle(Form("Intensity (TOF) %s", opt));
    ga->GetXaxis()->SetTitle("TOF");
    ga->GetYaxis()->SetTitle("Intensity");
    ga->Draw("ap");
}
开发者ID:akusumoto,项目名称:root-tomoyori-bragg,代码行数:11,代码来源:compare_integration.C

示例13: draw_rhotau

void plotter::draw_rhotau(TSpline *rhotau, double tau, TString file_name){
  TCanvas *c = new TCanvas("c","",600,600);
  gPad->SetLeftMargin(0.15);
  TGaxis::SetMaxDigits(3);
  double logtau = TMath::Log10(tau);
  std::vector<double> Xpoint = {logtau};
  std::vector<double> Ypoint = {rhotau->Eval(logtau)};
  TGraph * point = new TGraph(1, &Xpoint[0], &Ypoint[0]);
  point->SetTitle(" ");
  point->GetXaxis()->SetTitle("log #tau");
  point->GetYaxis()->SetTitle("#rho(log #tau)");
  point->GetYaxis()->SetTitleOffset(1.5);
  point->GetXaxis()->SetNdivisions(505);
  point->GetYaxis()->SetNdivisions(505);
  point->SetMarkerStyle(20);
  point->SetMarkerSize(1.5);
  point->SetLineColor(1);
  point->Draw("AP");
  point->GetXaxis()->SetLimits(-4.0, -1.5);
  double ymin = Ypoint[0]*0.95;
  double ymax = 1.15;
  point->GetYaxis()->SetRangeUser(ymin, ymax);
  point->Draw("AP");
  c->Update();

  // gPad->SetLogx();

  rhotau->SetLineColor(kCyan+2);
  rhotau->SetLineWidth(2);
  rhotau->Draw("L SAME");
  point->Draw("P SAME");

  TLegend *l=new TLegend(0.55,0.65,0.85,0.8);
  l->SetBorderSize(0);
  l->SetFillStyle(0);
  l->AddEntry(point,"final #tau value","pl");
  l->AddEntry(rhotau,"#tau scan","l");
  l->Draw();
  c->SaveAs(directory + file_name + ".pdf");
  delete c;
}
开发者ID:UHH2,项目名称:MTopJet,代码行数:41,代码来源:plotter.C

示例14: plot_times

void plot_times() {

  TCanvas *c1 = new TCanvas("c1", "c1", 1600, 600);

  ifstream ifs;
  ifs.open("time_list.txt");
  assert(ifs.is_open());
  string line;

  Int_t month, day, hour, min, sec;

  vector<Int_t> times;
  vector<Int_t> count;

  while(getline(ifs,line)) {
    if(line[0]=='#') continue;

    stringstream ss(line);
    ss >> month >> day >> hour >> min >> sec;

    TDatime da(2014, month, day, hour, min, sec);
    times.push_back(da.Convert());
    count.push_back(1);
  }

  TGraph *gr = new TGraph(times.size(), &(times[0]), &(count[0]));
  gr->SetMarkerStyle(20);

  gr->GetXaxis()->SetTimeDisplay(1); 
  gr->GetXaxis()->SetNdivisions(-503); 
  gr->GetXaxis()->SetTimeFormat("%Y-%m-%d %H:%M"); 
  gr->GetXaxis()->SetTimeOffset(0,"gmt"); 
  gr->GetYaxis()->SetRangeUser(0.8,1.2);

  gr->Draw("ap");

}
开发者ID:jaylawhorn,项目名称:junior-lab,代码行数:37,代码来源:plot_times.C

示例15: readGr

void readGr() {

	TGraph *gr = new TGraph("graph.dat");//  read txt file
	TCanvas *c1 = new TCanvas();
	gr->SetLineColor(2);
    gr->SetLineWidth(4);
    gr->SetMarkerColor(4);
    gr->SetMarkerStyle(21);
    gr->SetTitle("Draw graph from ASCII file");
    gr->GetXaxis()->SetTitle("X title");
    gr->GetYaxis()->SetTitle("Y title");
		
	gr->Draw("LAP");   //A -> Axis P->Point L->Line(Default)

}
开发者ID:hyeahyun,项目名称:ROOT,代码行数:15,代码来源:readGr.C


注:本文中的TGraph::GetXaxis方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。