# Trouble with pyroot about drawing a function

**URL:** <https://root-forum.cern.ch/t/trouble-with-pyroot-about-drawing-a-function/52022>\
**Category:** Newbie\
**Tags:** python, root\
**Created:** [October 19, 2022, 2:00am UTC](https://root-forum.cern.ch/t/trouble-with-pyroot-about-drawing-a-function/52022 "2022-10-19T02:00:31Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mehmet\_Durgut](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/mehmet_durgut/32/31233_2.png) [@Mehmet\_Durgut](https://root-forum.cern.ch/u/Mehmet_Durgut)\
**Post date:** [October 19, 2022, 2:00am UTC](https://root-forum.cern.ch/t/trouble-with-pyroot-about-drawing-a-function/52022/1 "2022-10-19T02:00:33Z")

</div>

ROOT Version: 6.26  
Platform: MacOS Catalina

I am newbie in HEP and I was trying to use root with python so, when I use python prompt like below I get the graph like this

 ![Screen Shot 2022-10-19 at 4.55.31 AM](https://root-forum.cern.ch/uploads/default/original/3X/9/9/9963878be35f0c61949ef34cb55ada2372445a5e.jpeg)

Nonetheless, I am not able to get the same graph when I try to execute the script,

 ![Screen Shot 2022-10-19 at 4.47.23 AM](https://root-forum.cern.ch/uploads/default/original/3X/2/b/2b7edd498d8dbea29085e05ef58a24f5169022bb.png)

I really appreciate it for any help

---

<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:** [October 19, 2022, 6:48am UTC](https://root-forum.cern.ch/t/trouble-with-pyroot-about-drawing-a-function/52022/2 "2022-10-19T06:48:59Z")

</div>

`python3 -i ...`

---

<div class="post-metadata">

**Author:** ![Mehmet\_Durgut](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/mehmet_durgut/32/31233_2.png) [@Mehmet\_Durgut](https://root-forum.cern.ch/u/Mehmet_Durgut)\
**Post date:** [October 19, 2022, 12:42pm UTC](https://root-forum.cern.ch/t/trouble-with-pyroot-about-drawing-a-function/52022/3 "2022-10-19T12:42:28Z")

</div>

Then graph don’t show up either and I am getting this:

 ![Screen Shot 2022-10-19 at 3.40.39 PM](https://root-forum.cern.ch/uploads/default/original/3X/4/7/4764b3ff0e421ea6e64ec6770a0421dbf0a6a0c8.jpeg)

---

<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:** [October 19, 2022, 12:45pm UTC](https://root-forum.cern.ch/t/trouble-with-pyroot-about-drawing-a-function/52022/4 "2022-10-19T12:45:52Z")

</div>

After the “`Draw`”, try to add: `ROOT.gPad.Modified(); ROOT.gPad.Update()`

---

<div class="post-metadata">

**Author:** ![Mehmet\_Durgut](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/mehmet_durgut/32/31233_2.png) [@Mehmet\_Durgut](https://root-forum.cern.ch/u/Mehmet_Durgut)\
**Post date:** [October 19, 2022, 1:04pm UTC](https://root-forum.cern.ch/t/trouble-with-pyroot-about-drawing-a-function/52022/5 "2022-10-19T13:04:52Z")

</div>

Thank you it worked but is there any way to do without “ **python3 -i …** ”
