Unable to st the x and y axis titles

Dear Experts,

I have divided my canvas in to (2,4)arrangements but and I have all the plots in the required place but I am not able to set the x and y axis titles for any of the plots. using the usual
h16->GetXaxis()->SetTitle("abc");

Will you please help. I have tried it using root 6.24 and 6.28 in ubuntu. Here;s my working directory. folder.zip - Google Drive

Regards,
Sanjee

Your code cannot be run, we are missing 2 data files. Also, it is much better if you reduce the code to a minimum working example that shows your problem.

1 Like

Dear @dastudillo,

Thanks for your prompt response. Please see consider this version of the macro.
sames_tratio_wt.C (19.5 KB)

You have

  c->cd(8); 
  // gPad->SetBottomMargin(0); // Adjust bottom margin for the first pad
  // gPad->SetTopMargin(0); 
  
  h15->SetMinimum(1.);
  h15->SetStats(0);          // No statistics on upper plot
  h15->Draw("HIST");
  h15->SetLineColor(kBlue);
  h15->SetLineWidth(2);
  // h15->SetFillStyle(3004);
  // h15->SetFillColor(kBlue);
  // h15->GetYaxis()->SetTitle("Candidates per 0.02");//cos
  h15->GetYaxis()->SetTitleFont(43);

  // h2 attributes
  h16->SetMinimum(1.);            
  h16->Draw("sames");
  h16->SetStats(0);          // No statistics on upper plot
  h16->SetLineColor(kRed);
  h16->SetLineWidth(2);
  h16->GetXaxis()->SetTitle("Candidates per 0.02");//cos

When using “same”, only the axes of the first drawn histo are kept, so you should do SetTitle on h15, not h16, and similar for other pads. An alternative is to add the histos to a THStack (for each pad), so you only have to worry about formatting one object; also, note that when using “same”, if the scales, bins, limits, etc of the histos don’t match you may not see all the data of one or more of the histos, since, again, only the frame of the first one drawn is used.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.