Re: [ROOT] Rotated 1D Histograms?

From: Denis NOUAIS (nouais@to.infn.it)
Date: Thu Nov 02 2000 - 10:21:15 MET


Hi Stephen,

I had more or less the same problem a few days ago. As a temporary
(incomplete) solution, I wrote the following function:


void myDraw(TH1F* histo)
{
// function to draw a 1D histogram exchangind x and y axes

   TH2F* hDraw = new TH2F("hDraw", histo->GetTitle(),
                          1, 0.,
                          1.1 * histo->GetMaximum(),
                          1, histo->GetXaxis()->GetXmin(),
                          histo->GetXaxis()->GetXmax());

   hDraw->Draw();

   TLine* l = new TLine();
   l->DrawLine(0, h->GetBinLowEdge(1),
               h->GetBinContent(1), h->GetBinLowEdge(1));
   for (Int_t i = 1; i <= h->GetNbinsX(); i++) {
      l->DrawLine(h->GetBinContent(i), h->GetBinLowEdge(i),
                  h->GetBinContent(i),
                  h->GetBinLowEdge(i) + h->GetBinWidth(i));
      l->DrawLine(h->GetBinContent(i), h->GetBinLowEdge(i + 1),
                  h->GetBinContent(i + 1),
                  h->GetBinLowEdge(i) + h->GetBinWidth(i));
   }

}



Cheers

   Denis

------------------------------------------------------------------------
 Istituto Nazionale di Fisica Nucleare | Office: A 39
 Via Pietro Giuria, 1                  | Phone: (+39)011-6707377/7359
 I-10125 TORINO (Italy)                | Fax:   (+39)011-6699579
------------------------------------------------------------------------
    
    

On Thu, 2 Nov 2000, Rene Brun wrote:

> Hi Stephen,
> As you have noticed, this option is currently not available.
> 
> Rene Brun
> 
> Stephen Bailey wrote:
> > 
> > Hello.
> > 
> > Is it possible to display 1D histograms rotated by 90 degrees?
> > e.g. I want to draw the projections of a 2D histogram in two
> > 1D histograms, but I want the y projection to be oriented such
> > that it really is a projection, i.e. rotated by 90 degrees
> > CCW from how a 1D histogram normally would be displayed.
> > 
> > Thanks.
> > 
> > Stephen
> 



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:36 MET