library: libHist #include "TAxis.h" |
TAxis
class description - source file - inheritance tree (.pdf)
public:
TAxis()
TAxis(Int_t nbins, Axis_t xmin, Axis_t xmax)
TAxis(Int_t nbins, const Axis_t* xbins)
TAxis(const TAxis& axis)
virtual ~TAxis()
virtual void CenterLabels(Bool_t center = kTRUE)
virtual void CenterTitle(Bool_t center = kTRUE)
const char* ChooseTimeFormat(Double_t axislength = 0) const
static TClass* Class()
virtual void Copy(TObject& axis) const
virtual void Delete(Option_t* = "")
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
virtual TObject* DrawClone(Option_t* = "") const
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
virtual Int_t FindBin(Axis_t x)
virtual Int_t FindBin(const char* label)
virtual Int_t FindFixBin(Axis_t x) const
virtual Axis_t GetBinCenter(Int_t bin) const
const char* GetBinLabel(Int_t bin) const
virtual Axis_t GetBinLowEdge(Int_t bin) const
virtual Axis_t GetBinUpEdge(Int_t bin) const
virtual Axis_t GetBinWidth(Int_t bin) const
virtual void GetCenter(Axis_t* center) const
Bool_t GetCenterLabels() const
Bool_t GetCenterTitle() const
Bool_t GetDecimals() const
Int_t GetFirst() const
THashList* GetLabels()
Int_t GetLast() const
virtual void GetLowEdge(Axis_t* edge) const
Bool_t GetMoreLogLabels() const
Int_t GetNbins() const
Bool_t GetNoExponent() const
virtual TObject* GetParent() const
Bool_t GetRotateTitle() const
virtual const char* GetTicks() const
virtual Bool_t GetTimeDisplay() const
virtual const char* GetTimeFormat() const
virtual const char* GetTimeFormatOnly() const
virtual const char* GetTitle() const
const TArrayD* GetXbins() const
Axis_t GetXmax() const
Axis_t GetXmin() const
virtual void ImportAttributes(const TAxis* axis)
virtual TClass* IsA() const
virtual void LabelsOption(Option_t* option = "h")
TAxis& operator=(const TAxis&)
virtual void RotateTitle(Bool_t rotate = kTRUE)
virtual void SaveAttributes(ofstream& out, const char* name, const char* subname)
virtual void Set(Int_t nbins, Axis_t xmin, Axis_t xmax)
virtual void Set(Int_t nbins, const Float_t* xbins)
virtual void Set(Int_t nbins, const Axis_t* xbins)
virtual void SetBinLabel(Int_t bin, const char* label)
virtual void SetDecimals(Bool_t dot = kTRUE)
virtual void SetDefaults()
virtual void SetDrawOption(Option_t* = "")
virtual void SetLimits(Axis_t xmin, Axis_t xmax)
virtual void SetMoreLogLabels(Bool_t more = kTRUE)
virtual void SetNoExponent(Bool_t noExponent = kTRUE)
virtual void SetParent(TObject* obj)
virtual void SetRange(Int_t first = 0, Int_t last = 0)
virtual void SetRangeUser(Axis_t ufirst, Axis_t ulast)
virtual void SetTicks(Option_t* option = "+")
virtual void SetTimeDisplay(Int_t value)
virtual void SetTimeFormat(const char* format = "")
virtual void SetTimeOffset(Double_t toffset, Option_t* option = "local")
virtual void ShowMembers(TMemberInspector& insp, char* parent)
virtual void Streamer(TBuffer& b)
void StreamerNVirtual(TBuffer& b)
virtual void UnZoom()
private:
Int_t fNbins Number of bins
Axis_t fXmin low edge of first bin
Axis_t fXmax upper edge of last bin
TArrayD fXbins Bin edges array in X
Int_t fFirst first bin to display
Int_t fLast last bin to display
UShort_t fBits2 second bit status word
Bool_t fTimeDisplay on/off displaying time values instead of numerics
TString fTimeFormat Date&time format, ex: 09/12/99 12:34:00
TObject* fParent !Object owning this axis
THashList* fLabels List of labels
public:
static const enum TAxis:: kTickPlus
static const enum TAxis:: kTickMinus
static const enum TAxis:: kAxisRange
static const enum TAxis:: kCenterTitle
static const enum TAxis:: kCenterLabels
static const enum TAxis:: kRotateTitle
static const enum TAxis:: kPalette
static const enum TAxis:: kNoExponent
static const enum TAxis:: kLabelsHori
static const enum TAxis:: kLabelsVert
static const enum TAxis:: kLabelsDown
static const enum TAxis:: kLabelsUp
static const enum TAxis:: kIsInteger
static const enum TAxis:: kMoreLogLabels
static const enum TAxis:: kDecimals
This class manages histogram axis. It is referenced by TH1 and TGraph.
To make a graphical representation of an histogram axis, this class
references the TGaxis class.
TAxis supports axis with fixed or variable bin sizes.
Labels may be associated to individual bins.
see examples of various axis representations drawn by class TGaxis.
TAxis(): TNamed(), TAttAxis()
TAxis(Int_t nbins,Axis_t xlow,Axis_t xup): TNamed(), TAttAxis()
*-*-*-*-*-*-*-*Axis constructor for axis with fix bin size*-*-*-*-*-*-*-*
*-* ===========================================
TAxis(Int_t nbins,const Axis_t *xbins): TNamed(), TAttAxis()
*-*-*-*-*-*-*-*Axis constructor for variable bin size*-*-*-*-*-*-*-*-*-*-*
*-* ======================================
~TAxis()
TAxis(const TAxis &axis) : TNamed(axis), TAttAxis(axis)
void CenterLabels(Bool_t center)
if center = kTRUE axis labels will be centered (hori axes only)
on the bin center
default is to center on the primary tick marks
This option does not make sense if there are more bins than tick marks
Bool_t GetCenterLabels() const
Return kTRUE if kCenterLabels bit is set, kFALSE otherwise.
void CenterTitle(Bool_t center)
if center = kTRUE axis title will be centered
default is right adjusted
Bool_t GetCenterTitle() const
Return kTRUE if kCenterTitle bit is set, kFALSE otherwise.
const char* ChooseTimeFormat(Double_t axislength)
Choose a reasonable time format from the coordinates in the active pad
and the number of divisions in this axis
If orientation = "X", the horizontal axis of the pad will be used for ref.
If orientation = "Y", the vertical axis of the pad will be used for ref.
void Copy(TObject &obj) const
*-*-*-*-*-*-*-*-*-*Copy axis structure to another axis-*-*-*-*-*-*-*-*-*-*-*
*-* ===================================
Int_t DistancetoPrimitive(Int_t, Int_t)
*-*-*-*-*-*-*-*-*-*-*Compute distance from point px,py to an axis*-*-*-*-*-*
*-* ============================================
void ExecuteEvent(Int_t event, Int_t px, Int_t py)
*-*-*-*-*-*-*-*-*-*-*Execute action corresponding to one event*-*-*-*
*-* =========================================
This member function is called when an axis is clicked with the locator
The axis range is set between the position where the mouse is pressed
and the position where it is released.
If the mouse position is outside the current axis range when it is released
the axis is unzoomed with the corresponding proportions.
Note that the mouse does not need to be in the pad or even canvas
when it is released.
Int_t FindBin(Axis_t x)
*-*-*-*-*-*-*-*-*Find bin number corresponding to abscissa x-*-*-*-*-*-*
*-* ===========================================
If x is underflow or overflow, attempt to rebin histogram
Int_t FindBin(const char *label)
Find bin number with label.
If label is not in the list of labels, add it.
If the number of labels exceeds the number of bins, double the number
of bins via TH1::LabelsInflate (if the histogram can be rebinned).
Int_t FindFixBin(Axis_t x) const
*-*-*-*-*-*-*-*-*Find bin number corresponding to abscissa x-*-*-*-*-*-*
*-* ===========================================
const char* GetBinLabel(Int_t bin) const
Return label for bin
Int_t GetFirst() const
return first bin on the axis
- 0 if no range defined
Int_t GetLast() const
return last bin on the axis
- fNbins if no range defined
Axis_t GetBinCenter(Int_t bin) const
*-*-*-*-*-*-*-*-*-*-*Return center of bin*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
*-* ====================
Axis_t GetBinLowEdge(Int_t bin) const
*-*-*-*-*-*-*-*-*-*-*Return low edge of bin-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
*-* ======================
Axis_t GetBinUpEdge(Int_t bin) const
*-*-*-*-*-*-*-*-*-*-*Return up edge of bin-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
*-* ======================
Axis_t GetBinWidth(Int_t bin) const
*-*-*-*-*-*-*-*-*-*-*Return bin width-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
*-* ================
void GetCenter(Axis_t *center) const
*-*-*-*-*-*-*-*-*Return an array with the center of all bins-*-*-*-*-*-*-*
*-* ===========================================
void GetLowEdge(Axis_t *edge) const
*-*-*-*-*-*-*-*-*Return an array with the lod edge of all bins-*-*-*-*-*-*-*
*-* =============================================
const char* GetTimeFormatOnly() const
Return *only* the time format from the string fTimeFormat
const char* GetTicks() const
return the ticks option (see SetTicks)
void LabelsOption(Option_t *option)
Set option(s) to draw axis with labels
option = "a" sort by alphabetic order
= ">" sort by decreasing values
= "<" sort by increasing values
= "h" draw labels horizonthal
= "v" draw labels vertical
= "u" draw labels up (end of label right adjusted)
= "d" draw labels down (start of label left adjusted)
Bool_t GetRotateTitle() const
Return kTRUE if kRotateTitle bit is set, kFALSE otherwise.
void ImportAttributes(const TAxis *axis)
Copy axis attributes to this
void RotateTitle(Bool_t rotate)
rotate title by 180 degrees
by default the title is drawn right adjusted.
if rotate is TRUE, the title is left adjusted at the end of the axis
and rotated by 180 degrees
void SaveAttributes(ofstream &out, const char *name, const char *subname)
Save axis attributes as C++ statement(s) on output stream out
void Set(Int_t nbins, Axis_t xlow, Axis_t xup)
*-*-*-*-*-*-*-*-*Initialize axis with fix bins*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
*-* =============================
void Set(Int_t nbins, const Float_t *xbins)
*-*-*-*-*-*-*-*-*Initialize axis with variable bins*-*-*-*-*-*-*-*-*-*-*-*-*
*-* ==================================
void Set(Int_t nbins, const Axis_t *xbins)
*-*-*-*-*-*-*-*-*Initialize axis with variable bins*-*-*-*-*-*-*-*-*-*-*-*-*
*-* ==================================
void SetDefaults()
Set axis default values (from TStyle)
Bool_t GetDecimals() const
Returns kTRUE if kDecimals bit is set, kFALSE otherwise.
see TAxis::SetDecimals
void SetDecimals(Bool_t dot)
Set the Decimals flag
By default, blank characters are stripped, and then the
label is correctly aligned. The dot, if last character of the string,
is also stripped, unless this option is specified.
One can disable the option by calling axis.SetDecimals(kTRUE).
The flag (in fBits2) is passed to the drawing function TGaxis::PaintAxis
void SetBinLabel(Int_t bin, const char *label)
Set label for bin
void SetLimits(Axis_t xmin, Axis_t xmax)
Set the axis limits
Bool_t GetMoreLogLabels() const
Return kTRUE if kMoreLogLabels bit is set, kFALSE otherwise.
void SetMoreLogLabels(Bool_t more)
Set the kMoreLogLabels bit flag
When this option is selected more labels are drawn when in log scale
and there is a small number of decades (<3).
The flag (in fBits) is passed to the drawing function TGaxis::PaintAxis
Bool_t GetNoExponent() const
Returns kTRUE if kNoExponent bit is set, kFALSE otherwise.
see TAxis::SetNoExponent
void SetNoExponent(Bool_t noExponent)
Set the NoExponent flag
By default, an exponent of the form 10^N is used when the label values
are either all very small or very large.
One can disable the exponent by calling axis.SetNoExponent(kTRUE).
The flag (in fBits) is passed to the drawing function TGaxis::PaintAxis
void SetRange(Int_t first, Int_t last)
Set the viewing range for the axis from bin first to last
To set a range using the axis coordinates, use TAxis::SetRangeUser.
void SetRangeUser(Axis_t ufirst, Axis_t ulast)
Set the viewing range for the axis from ufirst to ulast (in user coordinates)
To set a range using the axis bin numbers, use TAxis::SetRange.
void SetTicks(Option_t *option)
set ticks orientation
option = "+" ticks drawn on the "positive side" (default)
option = "-" ticks drawn on the "negative side"
option = "+-" ticks drawn on both sides
void SetTimeFormat(const char *tformat)
*-*-*-*-*-*-*-*-*-*-*Change the format used for time plotting *-*-*-*-*-*-*-*
*-* ========================================
The format string for date and time use the same options as the one used
in the standard strftime C function, i.e. :
for date :
%a abbreviated weekday name
%b abbreviated month name
%d day of the month (01-31)
%m month (01-12)
%y year without century
for time :
%H hour (24-hour clock)
%I hour (12-hour clock)
%p local equivalent of AM or PM
%M minute (00-59)
%S seconds (00-61)
%% %
This function allows also to define the time offset. It is done via %F
which should be appended at the end of the format string. The time
offset has the following format: 'yyyy-mm-dd hh:mm:ss'
Example:
h = new TH1F("Test","h",3000,0.,200000.);
h->GetXaxis()->SetTimeDisplay(1);
h->GetXaxis()->SetTimeFormat("%d\/%m\/%y%F2000-02-28 13:00:01");
This defines the time format being "dd/mm/yy" and the time offset as the
February 28th 2003 at 13:00:01
If %F is not specified, the time offset used will be the one defined by:
gStyle->SetTimeOffset. For example like that:
TDatime da(2003,02,28,12,00,00);
gStyle->SetTimeOffset(da.Convert());
void SetTimeOffset(Double_t toffset, Option_t *option)
Change the time offset
If option = "gmt" the time offset is treated as a GMT time.
void Streamer(TBuffer &R__b)
Stream an object of class TAxis.
void UnZoom()
Reset first & last bin to the full range
Inline Functions
void Delete(Option_t* = "")
TObject* DrawClone(Option_t* = "") const
THashList* GetLabels()
Int_t GetNbins() const
TObject* GetParent() const
Bool_t GetTimeDisplay() const
const char* GetTimeFormat() const
const char* GetTitle() const
const TArrayD* GetXbins() const
Axis_t GetXmin() const
Axis_t GetXmax() const
void SetDrawOption(Option_t* = "")
void SetParent(TObject* obj)
void SetTimeDisplay(Int_t value)
TClass* Class()
TClass* IsA() const
void ShowMembers(TMemberInspector& insp, char* parent)
void StreamerNVirtual(TBuffer& b)
TAxis& operator=(const TAxis&)
Author: Rene Brun 12/12/94
Last update: root/hist:$Name: $:$Id: TAxis.cxx,v 1.67 2005/08/29 10:45:06 brun Exp $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
ROOT page - Class index - Class Hierarchy - Top of the page
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.