# How to change the titles of pads in a canvas?

**URL:** <https://root-forum.cern.ch/t/how-to-change-the-titles-of-pads-in-a-canvas/38958>\
**Category:** Newbie\
**Created:** [April 18, 2020, 2:05am UTC](https://root-forum.cern.ch/t/how-to-change-the-titles-of-pads-in-a-canvas/38958 "2020-04-18T02:05:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![scippsean](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/s/9de0a6/32.png) [@scippsean](https://root-forum.cern.ch/u/scippsean)\
**Post date:** [April 18, 2020, 2:05am UTC](https://root-forum.cern.ch/t/how-to-change-the-titles-of-pads-in-a-canvas/38958/1 "2020-04-18T02:05:37Z")

</div>

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:

```auto
import ROOT as R
R.gStyle.SetOptStat(0)

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')
c2.Divide(2,1)
c2.cd(1)
projx0.Draw()
c2.cd(2)
projx1.Draw()
c2.Draw()

```

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.

 ![Screen Shot 2020-04-17 at 7.00.18 PM](https://root-forum.cern.ch/uploads/default/original/3X/e/4/e47c15c5355549efc345e7147fd73a3b85a6af25.png)

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

* * *

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [April 18, 2020, 7:40am UTC](https://root-forum.cern.ch/t/how-to-change-the-titles-of-pads-in-a-canvas/38958/2 "2020-04-18T07:40:57Z")

</div>

Try:

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

```

---

<div class="post-metadata">

**Author:** ![scippsean](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/s/9de0a6/32.png) [@scippsean](https://root-forum.cern.ch/u/scippsean)\
**Post date:** [April 18, 2020, 6:02pm UTC](https://root-forum.cern.ch/t/how-to-change-the-titles-of-pads-in-a-canvas/38958/3 "2020-04-18T18:02:42Z")

</div>

Absolutely incredible! Thank you very much!
