# Draw Smooth option problem

**URL:** <https://root-forum.cern.ch/t/draw-smooth-option-problem/44733>\
**Category:** Newbie\
**Created:** [May 6, 2021, 11:40am UTC](https://root-forum.cern.ch/t/draw-smooth-option-problem/44733 "2021-05-06T11:40:45Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Keyvan\_Tabaei](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/keyvan_tabaei/32/25908_2.png) [@Keyvan\_Tabaei](https://root-forum.cern.ch/u/Keyvan_Tabaei)\
**Post date:** [May 6, 2021, 11:40am UTC](https://root-forum.cern.ch/t/draw-smooth-option-problem/44733/1 "2021-05-06T11:40:45Z")

</div>

hi  
i want to draw a curve like this :  
 ![images](https://root-forum.cern.ch/uploads/default/original/3X/6/b/6b78b24a6f2a6f899d15b835274d3d7d3138e95e.png)  
i have rootfile and i a using this code for drawing :

```auto
TFile* f =new TFile("result.root");  
TCanvas* c1 = new TCanvas("c1", " ");
TTree* tree = (TTree*)f->Get("Ntuple1");
tree->Draw("x:y","pdd==10","C");

```

but this is my output:

 ![Screenshot from 2021-05-06 07-37-05](https://root-forum.cern.ch/uploads/default/original/3X/8/c/8c6d6e4eb13c0f5d2db94c45f8a4a38e6ddb316a.png)

i would like to connect points to each other like first curve.

how can i do this?

thanks  
[result.root](https://root-forum.cern.ch/uploads/short-url/lKW0ALlsY19y6aYeOgc7S6FLxVM.root) (605.1 KB)

---

<div class="post-metadata">

**Author:** ![bellenot](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/bellenot/32/29217_2.png) [@bellenot](https://root-forum.cern.ch/u/bellenot)\
**Post date:** [May 6, 2021, 12:04pm UTC](https://root-forum.cern.ch/t/draw-smooth-option-problem/44733/2 "2021-05-06T12:04:02Z")

</div>

Maybe @couet can give more details, but to draw contours only, use the `CONT1` or `CONT3` option

---

<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 6, 2021, 12:27pm UTC](https://root-forum.cern.ch/t/draw-smooth-option-problem/44733/3 "2021-05-06T12:27:13Z")

</div>

Your histogram is:

 ![Screenshot 2021-05-06 at 14.17.31](https://root-forum.cern.ch/uploads/default/original/3X/8/1/81670f9ecc3d646e909916256337d543fb38c166.jpeg)

So a contour with any of the CONT option with not draw the plot you are looking for. For instance CONT1 gives:

 ![Screenshot 2021-05-06 at 14.21.57](https://root-forum.cern.ch/uploads/default/original/3X/2/f/2f00abee27a051570a36853cc372cc093c1e4b6c.jpeg)

if you use

```auto
tree->Draw("x:y","pdd==10","L");

```

A graph with point line-connected will be produced but, has the points are not properly ordered, you will get:

 ![Screenshot 2021-05-06 at 14.20.06](https://root-forum.cern.ch/uploads/default/original/3X/b/7/b774b7c7468055d0debad95fbbbb3c64881d2ffc.jpeg)

The only way I can think of would be to extract the non empty bins from the histogram or the points of the TGraph when option L is used and order them properly to generate a contour.

---

<div class="post-metadata">

**Author:** ![Keyvan\_Tabaei](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/keyvan_tabaei/32/25908_2.png) [@Keyvan\_Tabaei](https://root-forum.cern.ch/u/Keyvan_Tabaei)\
**Post date:** [May 6, 2021, 1:42pm UTC](https://root-forum.cern.ch/t/draw-smooth-option-problem/44733/4 "2021-05-06T13:42:56Z")

</div>

thank you all for your responding 🌷  
i drawn all contour togather and used `CONT1` option and got this output

 ![Screenshot from 2021-05-06 09-37-23](https://root-forum.cern.ch/uploads/default/original/3X/5/7/57ef0df8e18be25de357af4e457561397135b01a.png)

it is what i wanted.

is there a way to put number on each contour like first picture which i sent in first post ?  
many thanks.

---

<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 6, 2021, 2:18pm UTC](https://root-forum.cern.ch/t/draw-smooth-option-problem/44733/5 "2021-05-06T14:18:02Z")

</div>

This is not foreseen by the option itself.  
Somme example here: [ROOT: tutorials/hist/ContourList.C File Reference](https://root.cern/doc/master/ContourList_8C.html)
