# Drawing two graphs in one canvas properly with ROOT

**URL:** <https://root-forum.cern.ch/t/drawing-two-graphs-in-one-canvas-properly-with-root/50123>\
**Category:** Newbie\
**Created:** [May 25, 2022, 3:38pm UTC](https://root-forum.cern.ch/t/drawing-two-graphs-in-one-canvas-properly-with-root/50123 "2022-05-25T15:38:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ALI\_MERT\_TURACLAR](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/ali_mert_turaclar/32/29803_2.png) [@ALI\_MERT\_TURACLAR](https://root-forum.cern.ch/u/ALI_MERT_TURACLAR)\
**Post date:** [May 25, 2022, 3:38pm UTC](https://root-forum.cern.ch/t/drawing-two-graphs-in-one-canvas-properly-with-root/50123/1 "2022-05-25T15:38:04Z")

</div>

I’m trying to plot two graphs in one canvas using Cern ROOT. When I use `gr -> Draw("ap")` and `gr2 -> Draw("p1 same")`, the lines of the plots are not visible, only the markers are visible. When I use `gr1 -> Draw("")` and `gr2 -> Draw("same")`, the first plot is visible with line and marker but the second plot is only visible with line and not markers.

I want to see both of their lines and markers. How can I do it? My code:

```auto
graph_one -> GetXaxis() -> SetTitle(" x ");
graph_one -> GetYaxis() -> SetTitle(" y ");
graph_one -> GetXaxis() -> SetRangeUser(0,8);
graph_one -> GetYaxis() -> SetRangeUser (0,3);
graph_one -> SetLineWidth(2);
graph_one -> SetLineColor(kBlack);
graph_one -> SetMarkerStyle(8);
graph_one -> SetMarkerSize(3);
graph_one -> SetMarkerColor(kRed);

graph_two -> SetLineWidth(2);
graph_two -> SetMarkerStyle(8);
graph_two -> SetMarkerSize(3);
graph_two -> SetLineColor(kBlue);
graph_two -> SetMarkerColor(kBlack);

graph_one -> Draw("");
graph_two -> Draw("same");

```

![Screenshot from 2022-05-25 14-00-03](https://root-forum.cern.ch/uploads/default/original/3X/9/e/9e7d2fd59f0e42745139845c3b9b33864d62f6a4.png)

* * *

_ROOT Version:_ 6.23/01  
_Platform:_ Linux  
_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:** [May 25, 2022, 4:49pm UTC](https://root-forum.cern.ch/t/drawing-two-graphs-in-one-canvas-properly-with-root/50123/2 "2022-05-25T16:49:16Z")

</div>

[`graph_one->Draw("ALP"); graph_two->Draw("LP");`](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:** [May 30, 2022, 8:32am UTC](https://root-forum.cern.ch/t/drawing-two-graphs-in-one-canvas-properly-with-root/50123/3 "2022-05-30T08:32:42Z")

</div>

See [ROOT: TGraphPainter Class Reference](https://root.cern/doc/master/classTGraphPainter.html)
