# 2d placeholder for graphs

**URL:** <https://root-forum.cern.ch/t/2d-placeholder-for-graphs/52327>\
**Category:** Newbie\
**Created:** [November 11, 2022, 4:55pm UTC](https://root-forum.cern.ch/t/2d-placeholder-for-graphs/52327 "2022-11-11T16:55:45Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![alex14](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/3ab097/32.png) [@alex14](https://root-forum.cern.ch/u/alex14)\
**Post date:** [November 11, 2022, 4:55pm UTC](https://root-forum.cern.ch/t/2d-placeholder-for-graphs/52327/1 "2022-11-11T16:55:45Z")

</div>

Hi, can someone please help me with how to make a 2D placeholder? I have several TGraphs, and I need to compare them all together in one graph, but they have different dimensions, and a placeholder would solve that problem. Thanks

---

<div class="post-metadata">

**Author:** ![Dilicus](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/dilicus/32/14338_2.png) [@Dilicus](https://root-forum.cern.ch/u/Dilicus)\
**Post date:** [November 12, 2022, 12:31pm UTC](https://root-forum.cern.ch/t/2d-placeholder-for-graphs/52327/2 "2022-11-12T12:31:29Z")

</div>

Hi,  
you can just create a TH2D and draw it and use it as a placeholder.

```auto
TH2D *h_placeholder=new TH2D("placeholder","your title",200, xmin,xmax,200,ymin,ymax);
h_placeholder->Draw();

```

Then you can draw all your graphs with the same option.

```auto
gr_1->Draw("PLsame")
...
gr_n->Draw("PLsame")

```

Stefano

---

<div class="post-metadata">

**Author:** ![alex14](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/3ab097/32.png) [@alex14](https://root-forum.cern.ch/u/alex14)\
**Post date:** [November 12, 2022, 7:17pm UTC](https://root-forum.cern.ch/t/2d-placeholder-for-graphs/52327/3 "2022-11-12T19:17:01Z")

</div>

Thank you so much!

---

<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:** [November 13, 2022, 8:52am UTC](https://root-forum.cern.ch/t/2d-placeholder-for-graphs/52327/4 "2022-11-13T08:52:03Z")

</div>

[There is NO “same” graphs’ drawing option.](https://root.cern/doc/master/classTGraphPainter.html)

---

<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:** [November 14, 2022, 12:54pm UTC](https://root-forum.cern.ch/t/2d-placeholder-for-graphs/52327/5 "2022-11-14T12:54:00Z")

</div>

To draw several graphs on the same plot and be sure all the graphs are visible, the best is to use [TMultigraph](https://root.cern/doc/master/classTMultiGraph.html). If you first draw a frame (by the way it is simpler to use [DrawFrame](https://root.cern/doc/master/classTPad.html#a4d1c8d5f3ea4fa95ba32faf535defdd0) than creating an empty histogram) and draw the graphs on top (without option `SAME` which does not exist for graphs) you may miss some parts of the graphs if they are outside the limits imposed by the frame.

---

<div class="post-metadata">

**Author:** ![alex14](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/3ab097/32.png) [@alex14](https://root-forum.cern.ch/u/alex14)\
**Post date:** [November 14, 2022, 7:19pm UTC](https://root-forum.cern.ch/t/2d-placeholder-for-graphs/52327/6 "2022-11-14T19:19:55Z")

</div>

Thank you
