本文整理汇总了C++中TGraph::SetTitle方法的典型用法代码示例。如果您正苦于以下问题:C++ TGraph::SetTitle方法的具体用法?C++ TGraph::SetTitle怎么用?C++ TGraph::SetTitle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TGraph
的用法示例。
在下文中一共展示了TGraph::SetTitle方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CheckNorm
void CheckNorm(double Min, double Max, double Step) {
vector <double> Mass;
vector <double> BranchingRatio;
vector <double> XSection;
for (double i=Min; i<Max; i+=Step) {
Mass.push_back(i);
BranchingRatio.push_back(GetBR(i));
XSection.push_back(GetXsection(i));
}
TGraph* BranchGraph = new TGraph(Mass.size(),&Mass[0],&BranchingRatio[0]);
TGraph* XSectionGraph = new TGraph(Mass.size(),&Mass[0],&XSection[0]);
BranchGraph->SetTitle("Interpolated Branching Ratios");
XSectionGraph->SetTitle("Interpolated Cross Sections");
BranchGraph->SetMarkerStyle(20);
XSectionGraph->SetMarkerStyle(20);
BranchGraph->SetMarkerSize(1);
XSectionGraph->SetMarkerSize(1);
TCanvas* c1 = new TCanvas("c1","c1",800,650);
c1->cd();
BranchGraph->Draw("AP");
c1->SaveAs("BranchingRatios.png");
c1->Clear();
XSectionGraph->Draw("AP");
c1->SaveAs("XSections.png");
delete BranchGraph;
delete XSectionGraph;
delete c1;
}
示例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);
}
示例3: 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 ;
}
示例4: 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();
}
示例5: setGraphOptions
void setGraphOptions(TGraph &g)
{
g.SetTitle("");
g.SetMarkerColor(1);
g.SetMarkerStyle(24);
g.SetMarkerSize(.5);
}
示例6: decroissance_pi
int decroissance_pi(float _p_pi = 1.0){
// random.seed(60934386)
TRandom3 rand;
rand.SetSeed();
//float _p_pi;
//cout << "Entrez l'impulsion des pions (en GeV) : p = ";
//cin >> _p_pi;
double x[1000] = {0.0};
double y[1000] = {0.0};
for (int i=0;i<1000;i++){
//double _theta_cm_mu = rand.Uniform(TMath::Pi());
double _theta_cm_mu = TMath::ACos(gRandom->Uniform(2.0)-1.0);
double _phi_cm_mu = rand.Uniform(2*TMath::Pi());
if (i < 10){
cout << "i: " << i << " th_cm_mu = " << _theta_cm_mu << endl;
}
double _theta_lab_mu = 0.0, _p_lab_mu = 0.0;
ThetaLab_mu(_p_pi, _theta_cm_mu, _theta_lab_mu, _p_lab_mu);
cout << "th_lab_mu= " << _theta_lab_mu << " _p_lab_mu= " << _p_lab_mu << endl;
x[i] = 1000*_theta_lab_mu;
y[i] = _p_lab_mu;
}
TGraph *graph = new TGraph(1000, x, y);
graph->SetTitle("Theta vs p_{LAB}");
graph->Draw("A*");
return 0;
}
示例7: plot
/**
* \brief Plots the data
* Plots the data in data_x and data_y
* \param bool autox , bool autoy actually not needed ;)
* \return bool on success
*/
bool Plotter::plot(bool autox , bool autoy){
for(size_t j = 0 ; j< graph.size(); j++){
try{
TGraph *gr = graph[j].get();
for(size_t i = 0; i < data_x.size(); i++){
gr->SetPoint(i,data_x[i], data_y[i]);
}
if(!opt.autox){
gr->GetHistogram()->GetXaxis()->SetRangeUser(opt.startx, opt.stopx);
}
if(!opt.autoy){
gr->GetHistogram()->GetYaxis()->SetRangeUser(opt.starty, opt.stopy);
}
gr->SetMarkerSize(0.2);
gr->GetHistogram()->SetXTitle(opt.xlabel.c_str());
gr->GetHistogram()->SetYTitle(opt.ylabel.c_str());
gr->SetTitle(opt.plot_name.c_str());
gr->Draw("A*");
}catch(std::runtime_error &e){
std::cerr << e.what() << std::endl;
return false;
}
}
return true;
}
示例8: 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();
}
示例9: 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
}
示例10: ProjectionX
void KVCanvas::ProjectionX(TH2* hh)
{
TString pname = Form("%s_px", hh->GetName());
Int_t ip = 1;
while (gROOT->FindObject(pname.Data())) {
pname = Form("%s_px%d", hh->GetName(), ip);
ip++;
}
TH1* px = hh->ProjectionX(pname.Data());
if (!px) return;
Double_t minY = (hh->GetYaxis()->GetXmin());
Double_t maxY = (hh->GetYaxis()->GetXmax());
Double_t dY = (maxY - minY) * 0.8;
Double_t maxH = px->GetBinContent(px->GetMaximumBin());
TGraph* gg = 0;
if ((gg = (TGraph*)gROOT->FindObject(Form("%s_gjx", hh->GetName())))) gg->Delete();
gg = new TGraph;
for (int i = 0; i < px->GetNbinsX(); i++) {
gg->SetPoint(i, px->GetBinCenter(i), minY + px->GetBinContent(i)*dY / maxH);
}
gg->SetName(Form("%s_gjx", hh->GetName()));
gg->SetTitle(Form("%s_gjx", hh->GetName()));
gg->SetLineColor(kBlack);
gg->SetMarkerColor(kBlack);
gg->SetMarkerStyle(8);
gg->Draw("PL");
Modified();
Update();
}
示例11: counts
TGraph*
makeGraph(const TArrayI& adcs, Int_t rate)
{
Int_t last = adcs.fArray[0];
TArrayI counts(4);
TGraph* graph = new TGraph(rate * adcs.fN);
graph->SetLineColor(rate);
graph->SetMarkerColor(rate);
graph->SetMarkerStyle(20+rate);
graph->SetLineStyle(rate);
graph->SetName(Form("rate%d", rate));
graph->SetTitle(Form("Rate %d", rate));
for (Int_t i = 0; i < adcs.fN; i++) {
counts.Reset(-1);
convert(rate, adcs.fArray[i], last, counts);
for (Int_t j = 0; j < rate; j++) {
Int_t idx = (i * rate + j);
Double_t x = (i + (rate > 1 ? Float_t(j+1) / rate-1 : 0));
graph->SetPoint(idx, x, counts[j]);
}
last = counts[rate - 1];
}
return graph;
}
示例12: 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();
}
示例13: 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;
}
示例14: tgraph
TGraph* tgraph(const char* name, const char* title, int color)
{
TGraph* t = new TGraph();
t->SetName(name);
t->SetTitle(title);
t->SetLineColor(color);
return t;
}
示例15: 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");
}