How to change the titles of pads in a canvas?

Hi everyone, I am having some serious issues with customizing pads in a canvas. First of all, I am using python to run root. Now for some background. I have a TH2F histogram from which I have taken several projections using ProjectionX. I then plot several of these projections in one canvas by first dividing the canvas then drawing on each pad. When I draw the histograms on the separate pads, titles on top of the pads are the title from the original TH2F histogram but I want to change them, in this case, to say which bin is being projected. Here is the relevant code:

import ROOT as R

pn1 = R.TH2F( "PN1" , "CH1 Normalized" , dimx, 0, dimx, dimy, 0, dimy)

#Skipped section of code where I fill the histogram

projx0 = pn1.ProjectionX( 'Bin 75' , 75, 75)
projx1 = pn1.ProjectionX( 'Bin 87' , 87, 87)

c2 = R.TCanvas( 'CH1' , 'CH1 Horizontal Projections')

For further reference, I have attached some plots. I apologize for the crappy image. I tried to upload them separately but since I am a new user, I am only allowed to upload one image so I just stuck them together. The top is a plot of the histogram pn1. It makes sense that in this plot, the title is “CH1 Normalized” because that is the title specified in pn1.

The bottom is the plot of the projections (result of code given above). Essentially I am taking horizontal cuts of the first plot along y = 75 and y = 87. I understand that when calling ProjectionX on pn1, the allowed arguments are only name, start bin, and end bin so I guess it keeps the title of its parent histogram but I would like to override this so above the plots I can have titles like “Bin 75” and “Bin 87”.

This is my first post, I am very new to root, and I appreciate any help you all can provide!

ROOT Version: 6.12.06
Platform: Not Provided
Compiler: Not Provided


projx0.SetTitle('Bin 75;my X;my Y')
projx1.SetTitle('Bin 87;my X;my Y')

Absolutely incredible! Thank you very much!