RE: TH2D in polar coords

From: Olivier Couet <Olivier.Couet_at_cern.ch>
Date: Mon, 13 Jul 2009 17:18:22 +0200


Hi,

As documented here the option POL should be used with LEGO and SURF options: http://root.cern.ch/root/html/THistPainter.html#HP19

Cheers, Olivier

From: owner-roottalk_at_root.cern.ch [mailto:owner-roottalk_at_root.cern.ch] On Behalf Of Jakub Cermák Sent: Monday, July 13, 2009 4:26 PM
To: roottalk (Mailing list discussing all aspects of the ROOT system.) Subject: [ROOT] TH2D in polar coords

Hello rooters,
I'm trying to make an 2D histogram in polar coordinates (I wanna visualize the sky - the azimuth and elevation angles). According to manual x should be angle and y radius (length?). But I can't just get it to work. Is there any HOW-TO?

My code:

        TH2D *hist=new TH2D("hist","hist", 90, -90, 90, 90, -90, 90);
        for(int i=0; i<10000;++i)
        {
                double y=gRandom->Uniform(90);
                double x=gRandom->Uniform(M_PI*2);
                hist->Fill(x,y);
        }
        hist->Draw("COLZ POL");

And it makes histogram like http://dl.jcermak.cz/rootpolar.png although I think it should make a circle 180 in diameter and in center in (0,0). Can you please tell me what I'm doing wrong?

Best regards,
Jakub Cermak

__________ Informace od ESET NOD32 Antivirus, verze databaze 4238 (20090713) __________

Tuto zpravu proveril ESET NOD32 Antivirus.

http://www.eset.cz Received on Mon Jul 13 2009 - 17:18:27 CEST

This archive was generated by hypermail 2.2.0 : Mon Jul 13 2009 - 23:50:01 CEST