# TH2Poly in polar coordinates

Dear ROOTers

I want to make a 2-D polar histogram.
The bin edges will be evenly spaced in radius.
But there will be an arbitrary number of angle bins at a given radius.
The only class I know to make bins with arbitrary shapes is the TH2Poly class.
So I want to use this and plot it in polar coordinates using the “pol” option.
I am using ROOT version 5.34/19.

Here is my failed attempt:

[code]void test_TH2Poly_polar()
{
TH2Poly *h = new TH2Poly();
Double_t a0[] = {0, 2, 2, 0};
Double_t r0[] = {0, 0, 1, 1};
Double_t a1[] = {0, 1, 1, 0};
Double_t r1[] = {1, 1, 2, 2};
Double_t a2[] = {1, 2, 2, 1};
Double_t r2[] = {1, 1, 2, 2};

``````h->AddBin(4, a0, r0);

h->Fill(1, 0.5, 1);
h->Fill(0.5, 1.5, 2);
h->Fill(1.5, 1.5, 3);

h->Draw("colz pol"); // <--- "pol" option not working
return;
``````

}

[/code]

Here is what the failed output looks like:
test_TH2Poly_polar.pdf (13.9 KB)

Hi,

actually you don’t need a TH2Poly here. It seems what you want are not arbitrary shapes, but just arbitrary bin borders. The TH2F allows you to do that already. See this answer to a similar problem:
[url]TH2F polar coordinates binning

Hope that helps.
Benedikt

The option pol is not implemented for th2poly