Hi!
I’m trying to produce a TH2 polar plot:
void test () {
gStyle->SetOptStat(0);
Double_t theta[] = {30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330, 360};
double r = 0.06;
TCanvas* c = new TCanvas("c", "c", 800, 800);
TH2D* d = new TH2D("d", "", 2, -1, 1, 2, -1, 1);
TH2D* h = new TH2D("p", "", 12, 0, 360, 12, 0, 1);
d->GetXaxis()->SetLabelSize(0);
d->GetYaxis()->SetLabelSize(0);
for (double t : theta) {
h->Fill(t, r);
r += 0.06;
}
d->Draw("COL");
h->Draw("col pol same");
}
The output:
I digged a bit in the forum here and I couldn’t find a way to avoid a dummy TH2 in order to draw the polar plot correctly. Is it mandatory?
Above all, why do I get a doily instead of the funny iridescent circle I want?
PS:
Sorry for bothering over and over, almost every single day.



