Re: TH2 scater plot
Rene Brun (Rene.Brun@cern.ch)
Thu, 08 Oct 1998 16:28:43 +0200
Tadeusz Pytlos wrote:
>
> Dear Rooters,
> I seems to be silly, but I cannot understand how the points
> are drawing by TH2F. I've a lot of integer numbers (points)
> to draw, so TH2 seems to be the only way.
> In TH1F it works well
>
> root [0] TH1F *h1=new TH1F("h1","h1",5,-0.5,4.5)
> root [1] h1.Fill(0)
> root [2] h1.SetMarkerStyle(8)
> root [3] h1.Draw()
> Warning in <MakeDefCanvas>: creating a default canvas with name c1
> root [4] h1.Draw("P")
> root [6] c1.SetGrid()
> root [7] h1.Draw("P")
>
> but in TH2F
> root [0] TH2F *h2=new TH2F("h2","h2",5,-0.5,4.5,5,-0.5,4.5)
> root [1] h2.SetMarkerStyle(8)
> root [2] h2.Fill(0,2)
> root [3] h2.Draw()
> Warning in <MakeDefCanvas>: creating a default canvas with name c1
> root [4] h2.Fill(2,2)
> root [5] h2.Draw()
> root [6] c1.SetGrid()
> root [7] h2.Draw()
>
> I cannot find any possibility to receive the right position
> of points. TH2S cannot help as well (is any reason for its
> existance?).
> Thanks for your time,
> Tadeusz
>
Tadeusz,
You use the wrong class to solve your problem.
I understand that you want simply to draw polymarkers.
Use TPolyMarker class.
You can use a TH2F dummy object to draw the frame, tehn
draw the TPolyMarker object inside this frame.
The TH2S creates a 2-d histogram with an array of shorts
instead of floats in TH2F. For many problems, TH2S is sufficient
if your cell contents are integers and integers fitting in 16 bits.
TH2C is the same for integers less than 256.
TH2C saves a factor 2 in memory and TH2C a factor 4 compared to TH2F.
Rene Brun