# Problem in TGraphPolar

**URL:** <https://root-forum.cern.ch/t/problem-in-tgraphpolar/19582>\
**Category:** ROOT\
**Created:** [July 22, 2015, 4:26am UTC](https://root-forum.cern.ch/t/problem-in-tgraphpolar/19582 "2015-07-22T04:26:32Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jeff820926](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/j/48db29/32.png) [@jeff820926](https://root-forum.cern.ch/u/jeff820926)\
**Post date:** [July 22, 2015, 4:26am UTC](https://root-forum.cern.ch/t/problem-in-tgraphpolar/19582/1 "2015-07-22T04:26:32Z")

</div>

Hi,

Does anyone know how to draw a TGraphPolar in the given data?  
In the figure 1, I use the code from the user guide to plot a polar graph.

 ![](http://i.imgur.com/eRrR6j3.jpg)  
[http://i.imgur.com/eRrR6j3.jpg](http://i.imgur.com/eRrR6j3.jpg)

I want to limit the range from 0 to Pi, that is, just the upper half of the graph. I change the rmax to Pi. However, it cannot made the correct plot which I want.

 ![](http://i.imgur.com/J4KGFbI.jpg)  
[http://i.imgur.com/J4KGFbI.jpg](http://i.imgur.com/J4KGFbI.jpg)

Does anyone know how to solve this problem?

Thanks!

---

<div class="post-metadata">

**Author:** ![ferhue](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/ferhue/32/29462_2.png) [@ferhue](https://root-forum.cern.ch/u/ferhue)\
**Post date:** [July 22, 2015, 8:09am UTC](https://root-forum.cern.ch/t/problem-in-tgraphpolar/19582/2 "2015-07-22T08:09:52Z")

</div>

You have to limit theta from 0 to pi instead of the radius r.

---

<div class="post-metadata">

**Author:** ![jeff820926](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/j/48db29/32.png) [@jeff820926](https://root-forum.cern.ch/u/jeff820926)\
**Post date:** [July 22, 2015, 8:42am UTC](https://root-forum.cern.ch/t/problem-in-tgraphpolar/19582/3 "2015-07-22T08:42:15Z")

</div>

> [@ferhue](#):
>
> You have to limit theta from 0 to pi instead of the radius r.

I think that doesn’t affect the result because it is just the wrong parameter name which is written in user guide.  
After I change the name of parameter, the result remains the same.

![](http://i.imgur.com/a2QZjrh.png)  
[http://i.imgur.com/a2QZjrh.png](http://i.imgur.com/a2QZjrh.png)

---

<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 30, 2015, 8:01am UTC](https://root-forum.cern.ch/t/problem-in-tgraphpolar/19582/4 "2015-07-30T08:01:16Z")

</div>

> [@](#):
>
> However, it cannot made the correct plot which I want.

What do you want exactly ?

---

<div class="post-metadata">

**Author:** ![ferhue](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/ferhue/32/29462_2.png) [@ferhue](https://root-forum.cern.ch/u/ferhue)\
**Post date:** [February 5, 2016, 4:47pm UTC](https://root-forum.cern.ch/t/problem-in-tgraphpolar/19582/5 "2016-02-05T16:47:30Z")

</div>

You were just missing to tell the TGraphPolar that your theta are radian (no idea what it expects by default). Then the polar graph is correct. Just add this:

```auto
CPol->Update();// Update, otherwise GetPolargram returns 0
grP1->GetPolargram()->SetToRadian();
```

Next time please post your script test2.cpp

 ![](https://root-forum.cern.ch/uploads/default/original/2X/d/d6b5ae9d335d3f0a0aaaf7efcb232c30e91cbaab.png)
