Hello,
Hope someone can help me with the following problems.
First Problem:
I want to plot several histograms (4x3) into one Canvas without spaces between them. I’m using c1->Divide(4,3,0,0) for this, which works fine but the axis labels become very small. If I increase their size by
hist->GetXaxis()->SetLabelFont(63);
hist->GetXaxis()->SetLabelSize(15);
so that they are readable they range over the canvas size.
Does anyone know how to increase the left margin of the canvas so that the bigger labels and axis titles fit? SetLeftMargin for the canvas does’t work at all and if I specify a left margin only for the ‘left side’ pads they become smaller than the other ones (see attachments).
Second problem:
Although I have the same range on the y-axis the tick marks of two adjacent histograms don’t fit. Any idea what’s wrong?
Third question:
Is their a global canvas title or do only the pads have titles? I would like to give some global information about the data I’m plotting as a kind of headline.
Thanks in advance
Petra
Script:
void spr_colz_iso()
{
gROOT->SetStyle(“Plain”);
gStyle->SetPalette(1);
gStyle->SetOptStat(1);
gStyle->SetOptFit(1);
gStyle->SetLineWidth(1);
gStyle->SetTextFont(63);
gStyle->SetTextSize(15);
gStyle->SetLabelSize(20,“xy”);
gStyle->SetLabelFont(63,“xy”);
gStyle->SetOptTitle(0);
// gStyle->SetTitleSize(5.0);
// gStyle->SetLabelSize(5);
gStyle->SetLineWidth(1);
//----------------------------------------------------------------------------
// Total SPR in calorimeter parts
//----------------------------------------------------------------------------
// gStyle->SetOptFit(1110);
// gStyle->SetOptStat(0);
int num = 0;
int iiso = 3;
char histname[1000];
char prjname[1000];
TCanvas *SPRTotC = new TCanvas(“SPRTotC”,“SPR in em/fh/ch in CC/ICR/EC”,900,600);
SPRTotC->Divide(4,3,0,0);
for (int ical = 0; ical < 3; ical++)
{
for (int idet = 0; idet < 4; idet++)
{
num++;
SPRTotC->cd(num);
gPad->SetTicks(1,1);
sprintf(histname, “ha_spr_tot_mu_cal%d_det%d_iso%d”, ical, idet, iiso);
TH2F* hist = (TH2F*)gROOT->FindObject(histname);
hist->GetXaxis()->SetRangeUser(0.0,50.0);
hist->GetXaxis()->SetNdivisions(205,0);
hist->GetXaxis()->SetLabelFont(63);
hist->GetXaxis()->SetLabelSize(15);
hist->GetXaxis()->SetTitleFont(63);
hist->GetXaxis()->SetTitleSize(15);
hist->GetXaxis()->SetTitleOffset(1.;
hist->GetYaxis()->SetRangeUser(0.0,5.0);
hist->GetYaxis()->SetNdivisions(205,0);
hist->GetYaxis()->SetLabelFont(63);
hist->GetYaxis()->SetLabelSize(15);
hist->GetYaxis()->SetTitleFont(63);
hist->GetYaxis()->SetTitleSize(15);
hist->GetYaxis()->SetTitleOffset(2.5);
SPRTotC->Update();
hist->Draw("colz");
}
}
}