Re: Scatterplot/Histogram?

From: Rene Brun (Rene.Brun@cern.ch)
Date: Tue Aug 24 1999 - 19:19:19 MEST


Hi Christopher,
The statement
 cains->Draw("NE:Time>>cains_plt","(NE > -500) && (NE < 500)");
creates both a TPolyMarker object and a TH2F object.
The TPolymarker object is used to plot the NE:Time values with high
precision,
the original variables are kept. However, by definition of a TH2F, some
information is lost because the data is entered into fix size cells.
When drawing the TH2F, the only thing possible is to draw random points
inside one cell.
You can change the default number of bins in the TH2F by allocating
yourself
the TH2F before executing the cains->Draw statement.
The TH2F is useful in the following situations:
  - you have a very large number of points
  - you want to use drawing options like "box", "lego", etc.

Rene Brun 

Christopher A. Stevens wrote:
> 
> I can follow the tutorials/examples and create a scatterplot as so.
> 
> TFile *f = new TFile("070299.root");  // contains the TTree cains
>                                       //  with branchs NE, Time
> cains->Draw("NE:Time>>cains_plt","(NE > -500) && (NE < 500)");
> 
> This gives me the correct plot of NE variable plotted against time.
> But then I try to use the resulting TH2F cains_plt, by doing
> cains_plt->Draw();
> and I don't get the same plot. Why?  Can I set an option or something
> to get the original scatterplot?
> 
> I can get around this by doing
> TGraph *neplt = new TGraph(cains->GetSelectedRows(), cains->GetV2(),
> cains->GetV1());
> but TGraph doesn't seem to have as many options as using TH2F.
> 
> --
> Christopher A. Stevens
> Navigation/Data Reduction
> Voice (301) 342-3181 x263 Fax   (301) 342-4745



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:38 MET