[ROOT] Controle Axis of a MultiGraph?

From: Christian Hansen (christian.hansen@cern.ch)
Date: Tue May 25 2004 - 17:26:40 MEST


Dear Rooters,

how can I controle the Y-axis in a MultiGraph?
I've tried with both
    GetYaxis()->SetLimits
and with
    SetMaximum
(see comment out line in the attached simplified example)
but nothing works.

Thanks
/Chris


#include "iostream"
#include "TH1.h"
#include "TF1.h"
#include "TCanvas.h"

void test() {
  gROOT->Reset();

  const Int_t n = 7;
  Float_t signal[n]  = {2022.89,  346.704,  322.063,  192.962,  59.6308,  33.8207, 29.2591};
  Float_t bkg1[n]    = {45620000, 54753.1,  50866.3,  6359.43,  1154.19,  679.738, 510.944};
  Float_t x[n]  = {0, 1, 2, 3, 4, 5, 6};
  
  TCanvas *c1 = new TCanvas("test","test",10,10,700,500);
  TGraph* gr1 = new TGraph(n,x,signal);
  gr1->SetMarkerStyle(3);
  //gr1->GetYaxis()->SetLimits(0,400.);
  //gr1->SetMaximum(400.);
  TGraph* gr2 = new TGraph(n,x,bkg1);
  gr2->SetMarkerStyle(21);
  //gr2->GetYaxis()->SetLimits(0,400.);
  //gr2->SetMaximum(400.);
  
  TMultiGraph* mg = new TMultiGraph();
  mg->Add(gr1,"lp");
  mg->Add(gr2,"lp");
  //mg->SetMaximum(400.); 
  mg->Draw("a");

}



This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:08 MET