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


C++ TMultiGraph类代码示例

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


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

示例1: makeScaleFactorHist

void makeScaleFactorHist(TCanvas* canvas, const std::string& name, const std::string& tag)
{
  TMultiGraph* multigraph = NULL;
  std::stringstream graphName;
  graphName << name << "ScaleFactorMultigraph";
  multigraph = (TMultiGraph*)canvas->GetPrimitive(graphName.str().c_str());
  if (multigraph == NULL) {
    std::cerr << "Error: no object of TCanvas " << canvas->GetName() << " with name ";
    std::cerr << graphName.str() << std::endl;
    return;
  }
  multigraph->GetYaxis()->SetRangeUser(0.3, 1.7);
  multigraph->GetYaxis()->SetLabelSize(0.03);
  canvas->Draw();
  canvas->SetCanvasSize(600,600);
  canvas->SetWindowSize(610,630);
  TPaveText* label = new TPaveText(0.25, 0.8, 0.55, 0.9, "NDC");
  label->SetTextFont(62);
  label->SetTextSize(0.03);
  label->SetBorderSize(0);
  label->SetFillColor(0);
  label->AddText("CMS 2011");
  label->AddText("");
  label->AddText("#int L dt = 204 pb^{-1}");
  label->SetTextAlign(11);
  label->Draw();
  std::stringstream file;
  file << "/data2/yohay/scaleFactor_" << tag << "_" << name << ".pdf";
  canvas->SaveAs(file.str().c_str());
}
开发者ID:rpyohay,项目名称:physics-tools,代码行数:30,代码来源:PrettyHistMaker.C

示例2: seg13

seg13()
{   
   const int n = 18;

   float x[n];
   float ex[n];
   float ey[n] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,38,97,76,197};
   float y[n]  = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,158,442,508,633};
   float z[n]  = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,44,124,101,183};
   

   for(int i=0; i<18; i++){
     x[i] =(i+1)*5; //the angle
     ex[i]=0;
     
  }
  
   
   TGraph *gr = new TGraph(n,x,z);
   TGraphErrors *gre = new TGraphErrors(n,x,y,ex,ey);
  
   TMultiGraph *mg = new TMultiGraph();
   mg->Add(gr,"lp");
   mg->Add(gre,"cp");

//   mg->GetXaxis()->SetTitle("angle");
//   mg->GetYaxis()->SetTitle("#envents/Sigma"); 

   mg->Draw("a");
}
开发者ID:jintonic,项目名称:gerdalinchenII,代码行数:30,代码来源:seg13.C

示例3: plotEffCurveMulti

void plotEffCurveMulti(const char* canvas,
		       int ngraph, int npts, const double* signalEff, 
		       const char classifiers[][200],
		       const double* bgrndEff, const double* bgrndErr,
		       double ymax, bool setMax=false)
{
  TCanvas *c
    = new TCanvas(canvas,"SPR BgrndEff vs SignalEff",200,10,600,400);
  TMultiGraph *mg = new TMultiGraph();
  if( setMax ) mg->SetMaximum(ymax);
  TLegend *leg = new TLegend(0.1,0.85,0.5,1.,
			     "SPR BackgroundEff vs SignalEff","NDC");
  for( int i=0;i<ngraph;i++ ) {
    TGraph *gr = new TGraphErrors(npts,signalEff,
				  bgrndEff+(i*npts),0,bgrndErr+(i*npts));
    gr->SetMarkerStyle(21);
    gr->SetLineColor(i+1);
    gr->SetLineWidth(3);
    gr->SetMarkerColor(i+1);
    mg->Add(gr);
    leg->AddEntry(gr,classifiers[i],"P");
  }
  mg->Draw("ALP");
  leg->Draw();
}
开发者ID:aashaqshah,项目名称:cmssw-1,代码行数:25,代码来源:spr_plot.C

示例4: CreateSinglePlotFromTable

void CreateSinglePlotFromTable(TString filename,TString XTitle="", TString YTitle="", bool boolLog=true){
  //  TString filename_=filename;
  ifstream infile;
  infile.open(filename.Data());
  if (!infile.is_open())
    return;

  cout << "filename " << filename << endl;

  char line[1024];
  int count=0;
  while (infile.good()){
    infile.getline(line,1024);
    //cout << line << endl;
    char * pch = strtok (line," ");
    while (pch != NULL){
      if (count){
	values.push_back(atof(pch));
      }else{
	labels.push_back(pch);
      }
      pch = strtok (NULL, " ");
    }
    count++;
  }
  TCanvas *c1 = new TCanvas();
  const size_t m = labels.size();
  int n = values.size()/labels.size();
  TGraph* gr[m];
  TMultiGraph *mg = new TMultiGraph();
  TLegend *tleg = new TLegend(0.9,1.,1.,0.80);
  double* x = (double*) malloc(m*n*sizeof(double));
  for (size_t i=0;i<n;++i) {
    for (size_t j=1;j<m;++j) {
    if (!i){
      gr[j-1]= new TGraph(n);
      gr[j-1]->SetMarkerStyle(19+j);
      gr[j-1]->SetMarkerColor(j);
      mg->Add(gr[j-1],"p");
      tleg->AddEntry(gr[j-1],labels[j],"p");
    }
    gr[j-1]->SetPoint(i,*(&values[0]+i*m),*(&values[0]+i*m+j));
    //cout << *(&values[0]+i*m)<< " " << *(&values[0]+i*m+j) << endl;
   }
  }
  if (boolLog)
    c1->SetLogy();
  mg->Draw("a");
  mg->GetXaxis()->SetTitle(XTitle);
  mg->GetYaxis()->SetTitle(YTitle);
  tleg->Draw();
  gPad->Update();
  c1->Print(filename.ReplaceAll(".dat",".gif"));
};
开发者ID:aashaqshah,项目名称:cmssw-1,代码行数:54,代码来源:CreateSinglePlotFromTable.C

示例5: Master_test

void Master_test( ){//main programme
    TChain* t = new TChain("rd51tbgeo");
    t->Add("../CRC-Run0308_Muon_10k_MSPL4_HVScan_710pt7_710pt1_710pt0_T20_T20_T20_Lat21-141010_224141-0.root");
    
    ClassReadTree CRC(t);

    TCanvas * c1 = new TCanvas("c1","",1);
    TGraphErrors *gr1 = new TGraphErrors(t->GetEntries());
    TGraphErrors *gr2 = new TGraphErrors(t->GetEntries());
    TGraphErrors *gr3 = new TGraphErrors(t->GetEntries());

    //for( int iEv = 0 ; iEv < t->GetEntries() ; iEv++){//
    for( int iEv = 0 ; iEv < 8 ; iEv++){//	Event Loop Starts
	t->GetEntry(iEv);

	//cout<<"===>  "<<CRC.g1xcl_geoposX[0]<<endl;
	//cout<<"===>  "<<CRC.g2xcl_geoposX[0]<<endl;
	//cout<<"===>  "<<CRC.g3xcl_geoposX[0]<<endl;
	if (CRC.g1xcl_geoposX[0]>0)
	    gr1->SetPoint(iEv*3, 100, CRC.g1xcl_geoposX[0]);
//	else
//	    gr1->SetPoint(iEv*3, 100, -10);
	if (CRC.g2xcl_geoposX[0]>0)
	    gr1->SetPoint(iEv*3+1, 380, CRC.g2xcl_geoposX[0]);
//	else
//	    gr1->SetPoint(iEv*3+1, 380, -10);
	if (CRC.g3xcl_geoposX[0]>0)
	    gr1->SetPoint(iEv*3+2, 830, CRC.g3xcl_geoposX[0]);
//	else
//	    gr1->SetPoint(iEv*3+2, 830, -10);

	
    }// End Event Loop
    gr1->SetMarkerColor(kBlue);
    gr1->SetMarkerStyle(21);
    gr2->SetMarkerColor(kRed);
    gr2->SetMarkerStyle(21);
    gr3->SetMarkerColor(kGreen);
    gr3->SetMarkerStyle(21);
    gr1->GetXaxis()->SetRangeUser(50., 900.);
    gr2->GetXaxis()->SetRangeUser(50., 900.);
    gr3->GetXaxis()->SetRangeUser(50., 900.);
    gr1->Draw("AP");
    //gr3->Draw("AP");
    //gr2->Draw("samesP*");
    //gr3->Draw("samesP*");
    TMultiGraph *mg = new TMultiGraph();
    mg->Add(gr1);
    mg->Add(gr2);
    mg->Add(gr3);
    //mg->Draw("APL");
    c1->SaveAs("Hit_Distribution.pdf");
}
开发者ID:ram1123,项目名称:TestBeamGeneralMacro,代码行数:53,代码来源:Master_test.C

示例6: entry

TMultiGraph *entry(const char *y_vs_x="help", TCut case1="", TCut case2="", TCut common="", Int_t entryNo=0
      , Int_t marker=7, Int_t color1=2, Int_t color2=4)
{
   if (strcmp(y_vs_x,"help")==0) {
      cout<< "Draws:    y vs x for tree with name \"t\" for conditions case1 and case2" <<endl;
      cout<< "Usage:    entry(y_vs_x, TCut case1, TCut case2, TCut common, Int_t entryNo, Int_t marker=7, Int_t color1=2, Int_t color2=4)" <<endl;
      cout<< "Example:  entry(\"y:x\", \"ch==1\", \"ch==2\", \"x>0&&x<20\", 9)" <<endl;
      return 0;
   }

   TTree *t = (TTree*) gDirectory->Get("t");
   if (!t) {
      cout<< "No tree \"t\" found" <<endl;
      return 0;
   }

   Long64_t nselected = 0;
   nselected = t->Draw(y_vs_x, common+case1, "", 1, entryNo);
   if (nselected == 0) {
      cout<< "--> case1 " << case1.GetTitle() << ": nselected == 0" <<endl;
      return 0;
   }
   TGraph* gr1 = gtempClone("gr1");
   gr1->SetMarkerStyle(marker);
   gr1->SetMarkerColor(color1);
   gr1->SetLineColor(color1);

   nselected = t->Draw(y_vs_x, common+case2, "", 1, entryNo);
   if (nselected == 0) {
      cout<< "--> case2 " << case2.GetTitle() << ": nselected == 0" <<endl;
      return 0;
   }
   TGraph* gr2 = gtempClone("gr2");
   gr2->SetMarkerStyle(marker);
   gr2->SetMarkerColor(color2);
   gr2->SetLineColor(color2);

   if (gROOT->GetListOfCanvases()->Last()) gPad->Clear();
   TMultiGraph* mg = new TMultiGraph();
   mg->SetTitle(Form("entry %d for %s and %s   %s",entryNo,case1.GetTitle(),case2.GetTitle(),common.GetTitle()));
   mg->Add(gr1,"pl");
   mg->Add(gr2,"pl");
   mg->Draw("aw");

   gPad->Modified();
   gPad->Update();

   return mg;
}
开发者ID:zatserkl,项目名称:root-macros,代码行数:49,代码来源:entry.C

示例7: main

//g++ allDataPrint.cpp `root-config --cflags --glibs`
int main(int argc, char** argv)
#endif
{
  int colore = 2;
  TMultiGraph *mg = new TMultiGraph("potenziale","Potenziali");
  cout<<"Carico i dati\n";
  ifstream filenames("infonamelist.txt");
  string filename = "settings.set";
  if(argc>1)
    filename  = argv[1];
  //carico il file di impostazioni, per ricompilare meno spesso
  while(!filenames.eof()){
    string fname;
    filenames >> fname;//fname non deve contenere spazi e ".txt"
    if(fname.find(".set")==string::npos)
      fname+=".set";
    if(fname!=".set"){
      impostazioni info("gauss.set", fname.c_str(),filename.c_str());
      cout << fname << ":" << endl;
      int ns = info.NL(), skip = info.spaceSkip();
      double step = info.spaceStep();
      TGraph *gV = new TGraph();
      int j=0;
      for(int i=0;i<ns;i+=skip){
	double x =  i*step;
	gV->SetPoint(j++,x,info.potenziale(i));
      }

      gV->SetTitle(("Potenziale per " +fname).c_str());    
      gV->SetLineColor(colore++);
      mg->Add(gV);
    }
  }
  TCanvas c1("c1","Confronto Potenziali",600,450);
  // c1.Divide(2,1);
  //c1.cd(1);
  // merr->Draw("apl");
    mg->Draw("apl");
  c1.BuildLegend();
  /*
    c1.cd(2);
    merr->Draw("apl");
    c1.BuildLegend();
  */
#ifndef __CINT__
  theApp.Run(true);
  return 0;
#endif
}
开发者ID:Iximiel,项目名称:Tesina-Calcolo2,代码行数:50,代码来源:CVDrawer.cpp

示例8: multigraph

TCanvas* multigraph()
{
   gStyle->SetOptFit();
   TCanvas *c1 = new TCanvas("c1","multigraph",700,500);
   c1->SetGrid();

   // draw a frame to define the range
   TMultiGraph *mg = new TMultiGraph();

   // create first graph
   const Int_t n1 = 10;
   Double_t px1[] = {-0.1, 0.05, 0.25, 0.35, 0.5, 0.61,0.7,0.85,0.89,0.95};
   Double_t py1[] = {-1,2.9,5.6,7.4,9,9.6,8.7,6.3,4.5,1};
   Double_t ex1[] = {.05,.1,.07,.07,.04,.05,.06,.07,.08,.05};
   Double_t ey1[] = {.8,.7,.6,.5,.4,.4,.5,.6,.7,.8};
   TGraphErrors *gr1 = new TGraphErrors(n1,px1,py1,ex1,ey1);
   gr1->SetMarkerColor(kBlue);
   gr1->SetMarkerStyle(21);
   gr1->Fit("pol6","q");
   mg->Add(gr1);

   // create second graph
   const Int_t n2 = 10;
   Float_t x2[]  = {-0.28, 0.005, 0.19, 0.29, 0.45, 0.56,0.65,0.80,0.90,1.01};
   Float_t y2[]  = {2.1,3.86,7,9,10,10.55,9.64,7.26,5.42,2};
   Float_t ex2[] = {.04,.12,.08,.06,.05,.04,.07,.06,.08,.04};
   Float_t ey2[] = {.6,.8,.7,.4,.3,.3,.4,.5,.6,.7};
   TGraphErrors *gr2 = new TGraphErrors(n2,x2,y2,ex2,ey2);
   gr2->SetMarkerColor(kRed);
   gr2->SetMarkerStyle(20);
   gr2->Fit("pol5","q");

   mg->Add(gr2);

   mg->Draw("ap");

   //force drawing of canvas to generate the fit TPaveStats
   c1->Update();
   TPaveStats *stats1 = (TPaveStats*)gr1->GetListOfFunctions()->FindObject("stats");
   TPaveStats *stats2 = (TPaveStats*)gr2->GetListOfFunctions()->FindObject("stats");
   stats1->SetTextColor(kBlue);
   stats2->SetTextColor(kRed);
   stats1->SetX1NDC(0.12); stats1->SetX2NDC(0.32); stats1->SetY1NDC(0.75);
   stats2->SetX1NDC(0.72); stats2->SetX2NDC(0.92); stats2->SetY1NDC(0.78);
   c1->Modified();
   return c1;
}
开发者ID:Y--,项目名称:root,代码行数:47,代码来源:multigraph.C

示例9: main

//g++ allDataPrint.cpp `root-config --cflags --glibs`
int main(int argc, char** argv)
#endif
{
  TCanvas c3("c3","Grafico",640,512);
  TCanvas c1("c1","Confronto",1280,512);
  c1.Divide(2,1);
  
  preparedraw myData (argv[1],
		      // preparedraw::doMax |
		      preparedraw::doFh |
		      preparedraw::doSh |
		      preparedraw::doErr);
  
  TGraph2D *g = myData.data();
  TGraph *gb = myData.firsthalf();//before
  TGraph *ga = myData.secondhalf();//after
  TGraph *gerrs = myData.errs();
  //  TGraph *maxs = myData.maximum();
  
  c3.cd();
  g->GetXaxis()->SetTitle("X");
  g->GetYaxis()->SetTitle("T");
  //g->Draw("cont1");
  g->Draw("pcol");
  //g->Draw();
  //grafo.Draw("surf1");

  cout<<"Disegno i grafici\n";
  TMultiGraph *mg = new TMultiGraph("integrali","Integrali prima e dopo la barriera");
  
  ga->SetLineColor(2);
  mg->Add(gb);
  mg->Add(ga);
  c1.cd(1);
  mg->Draw("apl");
    

  gerrs->SetTitle("Andamento degli errori");
  c1.cd(2);
  gerrs->Draw("apl");
#ifndef __CINT__
  theApp.Run(true);
  return 0;
#endif
}
开发者ID:Iximiel,项目名称:Tesina-Calcolo2,代码行数:46,代码来源:drawer.cpp

示例10: TCanvas

TCanvas *exclusiongraph() {
   // Draw three graphs with an exclusion zone.
   //Author: Olivier Couet
   
   TCanvas *c1 = new TCanvas("c1","Exclusion graphs examples",200,10,600,400);
   c1->SetGrid();

   TMultiGraph *mg = new TMultiGraph();
   mg->SetTitle("Exclusion graphs");

   const Int_t n = 35;
   Double_t x1[n], x2[n], x3[n], y1[n], y2[n], y3[n];
   for (Int_t i=0;i<n;i++) {
     x1[i]  = i*0.1;
     x2[i]  = x1[i];
     x3[i]  = x1[i]+.5;
     y1[i] = 10*sin(x1[i]);
     y2[i] = 10*cos(x1[i]);
     y3[i] = 10*sin(x1[i])-2;
   }

   TGraph *gr1 = new TGraph(n,x1,y1);
   gr1->SetLineColor(2);
   gr1->SetLineWidth(1504);
   gr1->SetFillStyle(3005);

   TGraph *gr2 = new TGraph(n,x2,y2);
   gr2->SetLineColor(4);
   gr2->SetLineWidth(-2002);
   gr2->SetFillStyle(3004);
   gr2->SetFillColor(9);

   TGraph *gr3 = new TGraph(n,x3,y3);
   gr3->SetLineColor(5);
   gr3->SetLineWidth(-802);
   gr3->SetFillStyle(3002);
   gr3->SetFillColor(2);

   mg->Add(gr1);
   mg->Add(gr2);
   mg->Add(gr3);
   mg->Draw("AC");

   return c1;
}
开发者ID:My-Source,项目名称:root,代码行数:45,代码来源:exclusiongraph.C

示例11: MultiGraph

void TDSPMultiEcho::Draw(Option_t *o, Double_t x0, Double_t x1, UInt_t num) {
  TString opt = o;
  opt.ToLower();

  Ssiz_t pos;

  if ((pos = opt.Index("multi"))!= kNPOS) {
    opt.Remove(pos,5);
    TMultiGraph *m = MultiGraph(NULL,x0,x1,num);
    m->Draw(o);
    m->GetXaxis()->SetTitle("#tau / #mu s");
    gPad->Update();
    return;
  }
  TGraph *a = Graph(NULL,x0,x1,num);
  a->Draw(o);
  a->GetXaxis()->SetTitle("#tau / #mu s");
  gPad->Update();
}
开发者ID:mvancompernolle,项目名称:ai_project,代码行数:19,代码来源:TDSPMultiEcho.cpp

示例12: graph_project

// make graphs for the project
void graph_project(plot_args args, bool adjust_time) {

  // declare canvas, graphs, multigraph, legend
  TCanvas *c1 = new TCanvas("c1", "Thermal Profile", 200, 10, 700, 500);
  TGraph *graphs[args.num_channels];
  TMultiGraph *mg = new TMultiGraph();
  string mg_title = args.title + ";" + "Time elapsed (min); Temperature (C)";
  mg->SetTitle(mg_title.c_str());

  // make legend
  TLegend *leg = make_legend();

  // make graphs and add to multigraph
  string directory = "./THERM_TESTS/" + args.projects[0] + "/" + args.projects[0] + "_ch";
  for(int i=0; i<args.num_channels; i++) {

    // file to open: time_adjusted or raw
    string file;
    if (args.time_shifts[0]==0 && args.time_cut==0) {
      file = directory + to_string(i) + ".txt";
      cout << file << endl;
    }
    else {
      file = "./THERM_TESTS/TEMP/temp_ch" + to_string(i) + ".txt";
    }
    // make graph from the obtained file
    graphs[i] = new TGraph(file.c_str());
    graphs[i]->SetLineWidth(2);
    graphs[i]->SetMarkerColorAlpha(i+1, 0);
    graphs[i]->SetLineColor(i+1);
    graphs[i]->SetFillColor(0);

    //add to multigraph and legend
    mg->Add(graphs[i]);
    leg->AddEntry(graphs[i], (args.leg_labels[i]).c_str()); 
  }

  // draw multigraph and legend; return.
  mg->Draw("ACP");
  leg->Draw();
  return;
}
开发者ID:jacobpierce1,项目名称:thermometer-analyzer,代码行数:43,代码来源:PlotData.cpp

示例13: TMultiGraph

TMultiGraph *time_series( TGraph *g[], TString legend[], TString ptitle, TString ytitle, Int_t nsensor ) {

  TMultiGraph *mg = new TMultiGraph( "mg", "mg" );
  
  TLegend *leg = new TLegend(0.8680651,0.7870257,0.9982345,0.9987,NULL,"brNDC");

  Int_t icolor = 1;
  
  for ( Int_t i = 0; i < nsensor; i++ ) {
    if ( g[i] != 0 ) {
      g[i]->SetMarkerColor( icolor );
      g[i]->SetLineColor( icolor++ );
      g[i]->SetMarkerStyle( kFullCircle );
      g[i]->SetMarkerSize( 0.35 );
      g[i]->SetTitle(legend[i]);
      g[i]->SetFillColor(0);
      g[i]->SetFillStyle(0);
      leg->AddEntry( g[i], legend[i], "L" );
      mg->Add( g[i], "P" );
      //    mg->Add( g[i], "L" );
    }
  }
  
  mg->Draw("a");
   
  // Make changes to axis after drawing, otherwise they don't exist
  mg->SetTitle( ptitle );
  mg->GetYaxis()->SetTitle( ytitle );

  mg->GetXaxis()->SetTimeDisplay(1);
  mg->GetXaxis()->SetNdivisions(-504); 
  mg->GetXaxis()->SetTitleOffset( 0.4 );
  mg->GetXaxis()->SetLabelOffset( 0.05 );
  mg->GetXaxis()->SetTimeFormat("#splitline{%m/%d/%y}{%H:%M:%S}");
  //  mg->GetXaxis()->SetTimeOffset(-4*3600,"gmt"); 
  leg->SetFillColor(0);
  leg->Draw();
  
  return mg;
}
开发者ID:haggerty,项目名称:radmon,代码行数:40,代码来源:plotradmon.C

示例14: Pulse_shape_int_graph

void Pulse_shape_int_graph(){		// name of file

using namespace std;

double bias=0;
int i=0;

TCanvas *c1 = new TCanvas("c1","c1", 600, 400);
TPad *pad1 = new TPad("pad1","",0,0,1,1);

TGraph *gr1[5];			// defines array to number of TGraphs

TMultiGraph *mg = new TMultiGraph();		// create multigraph

for (double bias=2;bias<=10;bias+=2){		// loop to create of graph for select bias values

	TString str1 =TString::Format("%.1f V",bias);		// creates string with bias value
	TString str2 =TString::Format("/afs/cern.ch/user/m/mbucklan/TCAD_Analysis/SimpleCMOS_2d/1pixel/Test_CC_Simple_Pixel_bias=%.0f.txt",bias);		// does some magic, creates string with name of file
	
	gr1[i] = new TGraph(str2,"%lE %lE");		// creates graph called gr and reads file
		
	gr1[i]->SetTitle(str1);			// sets title to string
	gr1[i]->SetLineColor(i+1);		// sets line colour, changes for each graph
	//gr1[i]->SetLineWidth(1);
	//gr1[i]->SetMarkerSize(0.9);
	//gr1[i]->SetMarkerStyle(21);
		
	mg->Add(gr1[i]);				// adds graph to multigraph
	i+=1;
	
}

pad1->Draw();
pad1->cd();
pad1->SetTickx(1);		//draws ticks on top side x axis
pad1->SetTicky(1);		//draws ticks on right hand side y axis

gPad->Update();

mg->Draw("AC");		// draws graph

// Make the graph look fancy...ish
mg->GetXaxis()->SetTitle("Time (s)");
mg->GetYaxis()->SetTitle("Collected Charge (C)");
mg->GetHistogram()->SetTitle("Colled Charge for 1 Pixel 100#mum Thick Sensor, Resistivity=100#Omegacm");

//mg->GetXaxis()->SetLimits(1.0e-8,11.5e-8);

TLegend *leg = new TLegend(.80,.70,.85,.87);
leg->AddEntry(gr1[0],"2V","l");
leg->AddEntry(gr1[1],"4V","l");
leg->AddEntry(gr1[2],"6V","l");
leg->AddEntry(gr1[3],"8V","l");
leg->AddEntry(gr1[4],"10V","l");

leg->SetTextSize(0.03);
leg->Draw();


}
开发者ID:mbucklan,项目名称:TCAD,代码行数:60,代码来源:Pulse_shape_int_graph.C

示例15: plotter

void plotter(Int_t octant=1){

gROOT->Reset();
gROOT->SetStyle("Plain");

TString runNums[5] = {"14296","15736","16654","17635","18875"};

TCanvas *c1 = new TCanvas();

TGraphErrors *gPos = new TGraphErrors(Form("md%dpos.dat",octant),"%lg %lg %lg");
TGraphErrors *gNeg = new TGraphErrors(Form("md%dneg.dat",octant),"%lg %lg %lg");

gPos->SetMarkerColor(kBlue);
gNeg->SetMarkerColor(kRed);
gPos->SetLineColor(kBlue);
gNeg->SetLineColor(kRed);
gPos->SetFillStyle(0);
gNeg->SetFillStyle(0);
gPos->SetTitle(Form("MD%dPOS",octant));
gNeg->SetTitle(Form("MD%dNEG",octant));

TMultiGraph *gm = new TMultiGraph("gm",Form("1/Yield for MD%d",octant));
gm->Add(gPos);
gm->Add(gNeg);

gm->Draw("ap");

gm->GetYaxis()->SetTitle("1/Yield (uA/V)");
gm->GetXaxis()->SetTitle("Run Number");

gm->GetXaxis()->SetNdivisions(505,kTRUE);

for(Int_t i=0; i<5; i++){
	gm->GetXaxis()->SetBinLabel(gm->GetXaxis()->FindBin(150000+i*10000),runNums[i].Data());

}
gm->GetXaxis()->SetTitleOffset(1.4);

c1->BuildLegend();


}
开发者ID:sjmacewan,项目名称:Qweak,代码行数:42,代码来源:plotter.C


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