# Histogram Drawing Frame Size

**URL:** <https://root-forum.cern.ch/t/histogram-drawing-frame-size/39132>\
**Category:** Newbie\
**Created:** [April 28, 2020, 12:49am UTC](https://root-forum.cern.ch/t/histogram-drawing-frame-size/39132 "2020-04-28T00:49:25Z")\
**Posts on this page:** 4\
**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 28, 2020, 12:49am UTC](https://root-forum.cern.ch/t/histogram-drawing-frame-size/39132/1 "2020-04-28T00:49:26Z")

</div>

* * *

Hello, I am plotting some 2d histograms and I would like the plot to be square. In other words, the x and y axes have the same range and bin width so I want that evident in the plot. As it stands, the drawing comes out rectangular. Here is the relevant code (in python):

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

pn3 = R.TH2F("PN3", "CH3 Normalized", dimx, 0, dimx, dimy, 0, dimy)

#Skipped section of code where I fill the histogram

c1 = R.TCanvas()
pn3.Draw('colz')
c1.Draw()

```

The result is the following image:

 ![ch3_norm](https://root-forum.cern.ch/uploads/default/original/3X/8/c/8c008c5b29d083f083ccf2dc33c4d7a463327766.png)

As you can see, the x-axis is longer than the y-axis and thus the image is squished a little. I think the relevant object to edit is the TFrame but I could not find anything useful in the reference guide for editing it to keep it square. Any help is appreciated!

\_ROOT Version: 6.12.06  
_Platform:_ Not Provided  
_Compiler:_ Not Provided

* * *

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [April 28, 2020, 7:07am UTC](https://root-forum.cern.ch/t/histogram-drawing-frame-size/39132/2 "2020-04-28T07:07:50Z")

</div>

You should create you [canvas square](https://root.cern/doc/master/classTCanvas.html). Do not use the default dimensions.

---

<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 28, 2020, 7:12am UTC](https://root-forum.cern.ch/t/histogram-drawing-frame-size/39132/3 "2020-04-28T07:12:53Z")

</div>

The canvas cannot be square because it’s the “blue” plot (i.e. excluding axes labels, all titles and the color palette) which needs to be square.

[ROOT forum -\> search -\> square aspect ratio](https://root-forum.cern.ch/search?q=square%20aspect%20ratio)

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [April 28, 2020, 7:32am UTC](https://root-forum.cern.ch/t/histogram-drawing-frame-size/39132/4 "2020-04-28T07:32:39Z")

</div>

If right, top, left, and bottom margin are equal a square canvas will be fine. if not the pad size will have to be adapted to make sure the plot area is square.
