# Multipad graphics

**URL:** <https://root-forum.cern.ch/t/multipad-graphics/17883>\
**Category:** ROOT\
**Created:** [July 8, 2014, 7:54am UTC](https://root-forum.cern.ch/t/multipad-graphics/17883 "2014-07-08T07:54:39Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Baloo](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/b/a87d85/32.png) [@Baloo](https://root-forum.cern.ch/u/Baloo)\
**Post date:** [July 8, 2014, 7:54am UTC](https://root-forum.cern.ch/t/multipad-graphics/17883/1 "2014-07-08T07:54:39Z")

</div>

Dear all,

I write to ask suggestions concerning the graphics of a multipad. Basically, what I would like to have is two vertical pads, attached to each other. This is what I get, but as you can see from the attached figure, there are some issues concerning the axis labels. For instance, I would like to have the X label only on the lower plot, while there is some overlap between the labels on the Y axis.

 ![](https://root-forum.cern.ch/uploads/default/original/2X/9/9271744d0eebc92c48b2640a9367d5b96f0999b8.jpg)  

Could you give some suggestions?

Thank you!

Best regards

---

<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:** [July 8, 2014, 8:15am UTC](https://root-forum.cern.ch/t/multipad-graphics/17883/2 "2014-07-08T08:15:28Z")

</div>

> [@](#):
>
> Could you give some suggestions?

Yes I can 🙂  
But the best is to send me the small macro you made to produce this plot and I’ll modify it for you.

---

<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:** [July 8, 2014, 8:16am UTC](https://root-forum.cern.ch/t/multipad-graphics/17883/3 "2014-07-08T08:16:04Z")

</div>

[${ROOTSYS}/tutorials/graphs/zones.C](https://root.cern.ch/doc/master/zones_8C.html)  
[${ROOTSYS}/tutorials/graphics/canvas2.C](https://root.cern.ch/doc/master/canvas2_8C.html)

[Formatting axis labels and more on a multi-pad canvas](https://root-forum.cern.ch/t/formatting-axis-labels-and-more-on-a-multi-pad-canvas/7428/1)  
[How to draw more than two histograms with adjacent axises](https://root-forum.cern.ch/t/how-to-draw-more-than-two-histograms-with-adjacent-axises/1207/1)  
[Drawing several histograms with Divide()](https://root-forum.cern.ch/t/drawing-several-histograms-with-divide/2115/1)

[Axis labels overlapped by pad](https://root-forum.cern.ch/t/axis-labels-overlapped-by-pad/6920/1)  
[Ratio plot](https://root-forum.cern.ch/t/ratio-plot/9439/1)  
[Two Histograms Sharing Same X-Axis](https://root-forum.cern.ch/t/two-histograms-sharing-same-x-axis/13494/1)  
[Removing only X axis from a histogram?](https://root-forum.cern.ch/t/removing-only-x-axis-from-a-histogram/4934/1)  
[Two adjacent Graphs](https://root-forum.cern.ch/t/two-adjacent-graphs/13644/1)

---

<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:** [July 8, 2014, 9:06am UTC](https://root-forum.cern.ch/t/multipad-graphics/17883/4 "2014-07-08T09:06:26Z")

</div>

Thanks for the macro you sent me. As far as I see the only remaining issue is the overlapping labels on the Y axis.  
It seems you manage to have the X axis labels only on the lower axis.  
Right ?

---

<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:** [July 8, 2014, 9:17am UTC](https://root-forum.cern.ch/t/multipad-graphics/17883/5 "2014-07-08T09:17:25Z")

</div>

```auto
void MultipadTest( ) { 

  gROOT->SetStyle("Plain");
  gStyle->SetOptStat(0);

  double DOSE[8] = {0., 1., 5., 10., 25., 50., 100., 140.};
  double DOM[8] = {0., 80., 338., 675., 1308., 1941., 2502., 2660.};
  
  
  TCanvas *c1 = new TCanvas("c1","multipads", 800, 700);
  gStyle->SetOptTitle(0);

  
  TPad *p1 = new TPad("p1", "p1", 0.2, 0.1, 0.8, 0.5, 0, 0, 0);
  p1->SetTopMargin(0);
  p1->Draw();
  
  TPad *p2 = new TPad("p2", "p2", 0.2, 0.5, 0.8, 0.9, 0, 0, 0);
  p2->SetTopMargin(0);
  p2->SetBottomMargin(0);
  p2->Draw();
  

  TGraph *gr = new TGraph(8, DOSE, DOM);
  gr -> SetMarkerStyle(20);
  gr -> SetMarkerSize(1.5);
  gr -> GetXaxis()->SetTitle("");   
  gr -> GetYaxis()->SetTitle("");   
  gr->SetMinimum(-100.); // Allow to make the 0 on Y axis higher
  
  p1->cd(); gr -> Draw("AP");
  p2->cd(); gr -> Draw("AP");

}

```

---

<div class="post-metadata">

**Author:** ![Baloo](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/b/a87d85/32.png) [@Baloo](https://root-forum.cern.ch/u/Baloo)\
**Post date:** [July 8, 2014, 10:06am UTC](https://root-forum.cern.ch/t/multipad-graphics/17883/6 "2014-07-08T10:06:38Z")

</div>

Thank you, now it looks already much better. However, I still have one problem. I still get the label on the X axis of the upper plot. I would like to skip it, since it is identical to the lower one. How can I do this?

 ![](https://root-forum.cern.ch/uploads/default/original/2X/9/912c9a9427cb2484b05770eca300f2a202eb90eb.jpg)  

Thanks again!

---

<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:** [July 8, 2014, 10:12am UTC](https://root-forum.cern.ch/t/multipad-graphics/17883/7 "2014-07-08T10:12:12Z")

</div>

You should set the label size to 0 for the upper plot:

```auto
   Graph_Upper->GetXaxis()->SetLabelSize(0);
```
