Re: [ROOT] Setting Zaxis range in a 2D Histogram surface plot.

From: Rene Brun (Rene.Brun@cern.ch)
Date: Thu Apr 19 2001 - 08:55:22 MEST


Hi Brendan,

To set the max/min on the axis depending on the bin contents:
  - y axis for a 1-d histogram h
  - z axis for a 2-d histogram h

do:
  h->SetMaximum(max)
  h->SetMinimum(min)

Note that the arguments to TAxis::SetRange are bin numbers and not axis
coordinates. Use TAxis::SetLimits to define the axis boundaries using
axis coordinates.

Logically TAxis::SetLimits should have been used instead of
SetMaximum/SetMinimum.
These names were chosen for historical reasons.

Rene Brun

By default the min and max are automatically computedBrendan Rankin wrote:
> 
> Hello ,
> 
> Here's a synopsis of what I'm doing....
> 
> I define two histograms, like so:
> 
> TH2F custErr("AtoY_cell_rise_custErr","Cell Rise Path A to
> Y",10,transBins,10,loadBins);
> TH2F smcErr("AtoY_cell_rise_SMCErr","Cell Rise Path A to
> Y",10,transBins,10,loadBins);
> 
> After filling these with data, I get the maximum and minimum values from
> the custErr histogram:
> 
> Float_t cust_max=custErr->GetMaximum();
> Float_t cust_min=custErr->GetMinimum();
> 
> I am then using these values to set the Zaxis range in both histograms:
> 
> smcErr.GetZaxis()->SetRange(cust_min,cust_max);
> smcErr.Draw("surf1zfb");
> 
> custErr.GetZaxis()->SetRange(cust_min,cust_max);
> custErr.Draw("surf1zfb");
> 
> Unfortunately, this doesn't impact what is drawn in the plot at all.
> The Zaxis is still sized, automatically, according to the data that is
> contained in each histogram, even though I've set this range manually.
> 
> Am I not doing something correctly?  Or, is what I'd like to do even
> possible?
> 
> Thanks, in advance, and Best Regards,
> 
> - Brendan



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:43 MET