Re: [ROOT] Reverse lower and upper ranges for TH2D?

From: Rene Brun (Rene.Brun@cern.ch)
Date: Thu Apr 15 2004 - 10:32:04 MEST


Hi Mark,

2-D histograms with axis coordinates increasing from right to left are
not supported. However, you can visualize a 2-D histogram with the option "surf"
by setting the viewing angles such that, eg the x axis coordinates will go
from right to left as shown in the small example below.

Rene Brun

{
  TH2F *hpxpy  = new TH2F("hpxpy","py vs px",40,-4,4,40,-4,4);
  Float_t px, py;
  TRandom r;
  for (Int_t i = 0; i < 25000; i++) {
     r.Rannor(px,py);
     hpxpy->Fill(px,py);
  }
  TCanvas *c1 = new TCanvas("c1");
  c1->SetTheta(90.001);
  c1->SetPhi(90.001);
  hpxpy->Draw("surf2");
}
  

Mark Polsen wrote:
> 
> Hello all,
> 
> Is there a way to reverse the lower and upper ranges for a TH2D? I'm
> using 2D histograms to display astrophysical sources in galactic
> coordinates. Currently, I can only display the longitude coordinates
> increasing from left to right. I'd like to display the longitude
> coordinates increasing from right to left.
> 
> Thanks,
> Mark



This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:07 MET