ROOT » HIST » HIST » TAxis

class TAxis: public TNamed, public TAttAxis


 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.

Function Members (Methods)

public:
virtual~TAxis()
voidTObject::AbstractMethod(const char* method) const
virtual voidTObject::AppendPad(Option_t* option = "")
virtual voidTObject::Browse(TBrowser* b)
Bool_tCanExtend() const
voidCenterLabels(Bool_t center = kTRUE)TOGGLE GETTER
voidCenterTitle(Bool_t center = kTRUE)TOGGLE GETTER
const char*ChooseTimeFormat(Double_t axislength = 0)
static TClass*Class()
virtual const char*TObject::ClassName() const
virtual voidTNamed::Clear(Option_t* option = "")
virtual TObject*TNamed::Clone(const char* newname = "") const
virtual Int_tTNamed::Compare(const TObject* obj) const
virtual voidCopy(TObject& axis) const
virtual voidDelete(Option_t* = "")
virtual Int_tDistancetoPrimitive(Int_t px, Int_t py)
virtual voidTObject::Draw(Option_t* option = "")
virtual voidTObject::DrawClass() constMENU
virtual TObject*DrawClone(Option_t* = "") const
virtual voidTObject::Dump() constMENU
virtual voidTObject::Error(const char* method, const char* msgfmt) const
virtual voidTObject::Execute(const char* method, const char* params, Int_t* error = 0)
virtual voidTObject::Execute(TMethod* method, TObjArray* params, Int_t* error = 0)
virtual voidExecuteEvent(Int_t event, Int_t px, Int_t py)
virtual voidTObject::Fatal(const char* method, const char* msgfmt) const
virtual voidTNamed::FillBuffer(char*& buffer)
virtual Int_tFindBin(Double_t x)
virtual Int_tFindBin(Double_t x) const
virtual Int_tFindBin(const char* label)
virtual Int_tFindFixBin(Double_t x) const
virtual Int_tFindFixBin(const char* label) const
virtual TObject*TObject::FindObject(const char* name) const
virtual TObject*TObject::FindObject(const TObject* obj) const
virtual Color_tTAttAxis::GetAxisColor() const
virtual Double_tGetBinCenter(Int_t bin) const
virtual Double_tGetBinCenterLog(Int_t bin) const
const char*GetBinLabel(Int_t bin) const
virtual Double_tGetBinLowEdge(Int_t bin) const
virtual Double_tGetBinUpEdge(Int_t bin) const
virtual Double_tGetBinWidth(Int_t bin) const
virtual voidGetCenter(Double_t* center) const
Bool_tGetCenterLabels() const
Bool_tGetCenterTitle() const
Bool_tGetDecimals() const
virtual Option_t*TObject::GetDrawOption() const
static Long_tTObject::GetDtorOnly()
Int_tGetFirst() const
virtual const char*TObject::GetIconName() const
virtual Color_tTAttAxis::GetLabelColor() const
virtual Style_tTAttAxis::GetLabelFont() const
virtual Float_tTAttAxis::GetLabelOffset() const
THashList*GetLabels() const
virtual Float_tTAttAxis::GetLabelSize() const
Int_tGetLast() const
virtual voidGetLowEdge(Double_t* edge) const
Bool_tGetMoreLogLabels() const
virtual const char*TNamed::GetName() const
Int_tGetNbins() const
virtual Int_tTAttAxis::GetNdivisions() const
Bool_tGetNoExponent() const
virtual char*TObject::GetObjectInfo(Int_t px, Int_t py) const
static Bool_tTObject::GetObjectStat()
virtual Option_t*TObject::GetOption() const
virtual TObject*GetParent() const
Bool_tGetRotateTitle() const
virtual Float_tTAttAxis::GetTickLength() const
virtual const char*GetTicks() const
virtual Bool_tGetTimeDisplay() const
virtual const char*GetTimeFormat() const
virtual const char*GetTimeFormatOnly() const
virtual const char*GetTitle() const
virtual Color_tTAttAxis::GetTitleColor() const
virtual Style_tTAttAxis::GetTitleFont() const
virtual Float_tTAttAxis::GetTitleOffset() const
virtual Float_tTAttAxis::GetTitleSize() const
virtual UInt_tTObject::GetUniqueID() const
const TArrayD*GetXbins() const
Double_tGetXmax() const
Double_tGetXmin() const
virtual Bool_tTObject::HandleTimer(TTimer* timer)
virtual ULong_tTNamed::Hash() const
virtual voidImportAttributes(const TAxis* axis)
virtual voidTObject::Info(const char* method, const char* msgfmt) const
virtual Bool_tTObject::InheritsFrom(const char* classname) const
virtual Bool_tTObject::InheritsFrom(const TClass* cl) const
virtual voidTObject::Inspect() constMENU
voidTObject::InvertBit(UInt_t f)
virtual TClass*IsA() const
virtual Bool_tTObject::IsEqual(const TObject* obj) const
virtual Bool_tTObject::IsFolder() const
Bool_tTObject::IsOnHeap() const
virtual Bool_tTNamed::IsSortable() const
Bool_tIsVariableBinSize() const
Bool_tTObject::IsZombie() const
virtual voidLabelsOption(Option_t* option = "h")MENU
virtual voidTNamed::ls(Option_t* option = "") const
voidTObject::MayNotUse(const char* method) const
virtual Bool_tTObject::Notify()
voidTObject::Obsolete(const char* method, const char* asOfVers, const char* removedFromVers) const
voidTObject::operator delete(void* ptr)
voidTObject::operator delete(void* ptr, void* vp)
voidTObject::operator delete[](void* ptr)
voidTObject::operator delete[](void* ptr, void* vp)
void*TObject::operator new(size_t sz)
void*TObject::operator new(size_t sz, void* vp)
void*TObject::operator new[](size_t sz)
void*TObject::operator new[](size_t sz, void* vp)
TAxis&operator=(const TAxis&)
virtual voidTObject::Paint(Option_t* option = "")
virtual voidTObject::Pop()
virtual voidTNamed::Print(Option_t* option = "") const
virtual Int_tTObject::Read(const char* name)
virtual voidTObject::RecursiveRemove(TObject* obj)
virtual voidTAttAxis::ResetAttAxis(Option_t* option = "")
voidTObject::ResetBit(UInt_t f)
voidRotateTitle(Bool_t rotate = kTRUE)TOGGLE GETTER
virtual voidTObject::SaveAs(const char* filename = "", Option_t* option = "") constMENU
virtual voidSaveAttributes(ostream& out, const char* name, const char* subname)
virtual voidTObject::SavePrimitive(ostream& out, Option_t* option = "")
virtual voidSet(Int_t nbins, const Float_t* xbins)
virtual voidSet(Int_t nbins, const Double_t* xbins)
virtual voidSet(Int_t nbins, Double_t xmin, Double_t xmax)
virtual voidTAttAxis::SetAxisColor(Color_t color = 1, Float_t alpha = 1.)MENU
virtual voidSetBinLabel(Int_t bin, const char* label)
voidTObject::SetBit(UInt_t f)
voidTObject::SetBit(UInt_t f, Bool_t set)
voidSetCanExtend(Bool_t canExtend)
voidSetDecimals(Bool_t dot = kTRUE)TOGGLE GETTER
virtual voidSetDefaults()
virtual voidSetDrawOption(Option_t* = "")
static voidTObject::SetDtorOnly(void* obj)
virtual voidTAttAxis::SetLabelColor(Color_t color = 1, Float_t alpha = 1.)MENU
virtual voidTAttAxis::SetLabelFont(Style_t font = 62)MENU
virtual voidTAttAxis::SetLabelOffset(Float_t offset = 0.0050000000000000001)MENU
virtual voidTAttAxis::SetLabelSize(Float_t size = 0.040000000000000001)MENU
virtual voidSetLimits(Double_t xmin, Double_t xmax)
voidSetMoreLogLabels(Bool_t more = kTRUE)TOGGLE GETTER
virtual voidTNamed::SetName(const char* name)MENU
virtual voidTNamed::SetNameTitle(const char* name, const char* title)
virtual voidTAttAxis::SetNdivisions(Int_t n = 510, Bool_t optim = kTRUE)MENU
virtual voidTAttAxis::SetNdivisions(Int_t n1, Int_t n2, Int_t n3, Bool_t optim = kTRUE)
voidSetNoAlphanumeric(Bool_t noalpha = kTRUE)
voidSetNoExponent(Bool_t noExponent = kTRUE)TOGGLE GETTER
static voidTObject::SetObjectStat(Bool_t stat)
virtual voidSetParent(TObject* obj)
virtual voidSetRange(Int_t first = 0, Int_t last = 0)MENU
virtual voidSetRangeUser(Double_t ufirst, Double_t ulast)MENU
virtual voidTAttAxis::SetTickLength(Float_t length = 0.029999999999999999)MENU
virtual voidSetTicks(Option_t* option = "+")MENU
virtual voidTAttAxis::SetTickSize(Float_t size = 0.029999999999999999)
virtual voidSetTimeDisplay(Int_t value)TOGGLE
virtual voidSetTimeFormat(const char* format = "")MENU
virtual voidSetTimeOffset(Double_t toffset, Option_t* option = "local")
virtual voidTNamed::SetTitle(const char* title = "")MENU
virtual voidTAttAxis::SetTitleColor(Color_t color = 1)MENU
virtual voidTAttAxis::SetTitleFont(Style_t font = 62)MENU
virtual voidTAttAxis::SetTitleOffset(Float_t offset = 1)MENU
virtual voidTAttAxis::SetTitleSize(Float_t size = 0.040000000000000001)MENU
virtual voidTObject::SetUniqueID(UInt_t uid)
virtual voidShowMembers(TMemberInspector& insp) const
virtual Int_tTNamed::Sizeof() const
virtual voidStreamer(TBuffer&)
voidStreamerNVirtual(TBuffer& ClassDef_StreamerNVirtual_b)
virtual voidTObject::SysError(const char* method, const char* msgfmt) const
TAxis()
TAxis(const TAxis& axis)
TAxis(Int_t nbins, const Double_t* xbins)
TAxis(Int_t nbins, Double_t xmin, Double_t xmax)
Bool_tTObject::TestBit(UInt_t f) const
Int_tTObject::TestBits(UInt_t f) const
virtual voidUnZoom()MENU
virtual voidTObject::UseCurrentStyle()
virtual voidTObject::Warning(const char* method, const char* msgfmt) const
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0)
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) const
virtual voidZoomOut(Double_t factor = 0, Double_t offset = 0)MENU
protected:
virtual voidTObject::DoError(int level, const char* location, const char* fmt, va_list va) const
voidTObject::MakeZombie()

Data Members

public:
static TAxis::(anonymous)kAxisRange
static TObject::(anonymous)TObject::kBitMask
static TObject::EStatusBitsTObject::kCanDelete
static TObject::EStatusBitsTObject::kCannotPick
static TAxis::(anonymous)kCenterLabels
static TAxis::(anonymous)kCenterTitle
static TAxis::(anonymous)kDecimals
static TObject::EStatusBitsTObject::kHasUUID
static TObject::EStatusBitsTObject::kInvalidObject
static TAxis::(anonymous)kIsInteger
static TObject::(anonymous)TObject::kIsOnHeap
static TObject::EStatusBitsTObject::kIsReferenced
static TAxis::(anonymous)kLabelsDown
static TAxis::(anonymous)kLabelsHori
static TAxis::(anonymous)kLabelsUp
static TAxis::(anonymous)kLabelsVert
static TAxis::(anonymous)kMoreLogLabels
static TObject::EStatusBitsTObject::kMustCleanup
static TObject::EStatusBitsTObject::kNoContextMenu
static TAxis::(anonymous)kNoExponent
static TObject::(anonymous)TObject::kNotDeleted
static TObject::EStatusBitsTObject::kObjInCanvas
static TObject::(anonymous)TObject::kOverwrite
static TAxis::(anonymous)kPalette
static TAxis::(anonymous)kRotateTitle
static TObject::(anonymous)TObject::kSingleKey
static TAxis::(anonymous)kTickMinus
static TAxis::(anonymous)kTickPlus
static TObject::(anonymous)TObject::kWriteDelete
static TObject::(anonymous)TObject::kZombie
protected:
Color_tTAttAxis::fAxisColorcolor of the line axis
Color_tTAttAxis::fLabelColorcolor of labels
Style_tTAttAxis::fLabelFontfont for labels
Float_tTAttAxis::fLabelOffsetoffset of labels
Float_tTAttAxis::fLabelSizesize of labels
TStringTNamed::fNameobject identifier
Int_tTAttAxis::fNdivisionsNumber of divisions(10000*n3 + 100*n2 + n1)
Float_tTAttAxis::fTickLengthlength of tick marks
TStringTNamed::fTitleobject title
Color_tTAttAxis::fTitleColorcolor of axis title
Style_tTAttAxis::fTitleFontfont for axis title
Float_tTAttAxis::fTitleOffsetoffset of axis title
Float_tTAttAxis::fTitleSizesize of axis title
private:
UShort_tfBits2second bit status word
Int_tfFirstfirst bin to display
THashList*fLabelsList of labels
Int_tfLastlast bin to display
Int_tfNbinsNumber of bins
TObject*fParent!Object owning this axis
Bool_tfTimeDisplayon/off displaying time values instead of numerics
TStringfTimeFormatDate&time format, ex: 09/12/99 12:34:00
TArrayDfXbinsBin edges array in X
Double_tfXmaxupper edge of last bin
Double_tfXminlow edge of first bin
static TAxis::(anonymous)kAlphanumeric
static TAxis::(anonymous)kCanExtend
static TAxis::(anonymous)kNotAlpha

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

TAxis()
 Default constructor.
TAxis(Int_t nbins, Double_t xmin, Double_t xmax)
 Axis constructor for axis with fix bin size
TAxis(Int_t nbins, const Double_t* xbins)
 Axis constructor for variable bin size
~TAxis()
 Destructor.
TAxis(const TAxis& axis)
 Copy constructor.
TAxis& operator=(const TAxis& )
 Assignment operator.
const char * ChooseTimeFormat(Double_t axislength = 0)
 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& axis) const
 Copy axis structure to another axis
Int_t DistancetoPrimitive(Int_t px, Int_t py)
 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(Double_t x)
 Find bin number corresponding to abscissa x. NOTE: this method does not work with alphanumeric bins !!!

 If x is underflow or overflow, attempt to extend the axis if TAxis::kCanExtend is true.
 Otherwise, return 0 or fNbins+1.
Int_t FindBin(const char* label)
 Find bin number with label.
 If the List of labels does not exist create it and make the axis alphanumeric
 If one wants just to add a single label- just call TAxis::SetBinLabel
 If label is not in the list of labels do the following depending on the
 bit TAxis::kCanExtend; of the axis.
   - if the bit is set add the new label and if the number of labels exceeds
      the number of bins, double the number of bins via TH1::LabelsInflate
   - if the bit is not set and the histogram has labels in each bin
        set the bit automatically and consider the histogram as alphanumeric
     if histogram has only some bins with labels then the histogram is not
     consider alphanumeric and return -1

 -1 is returned only when the Axis has no parent histogram
Int_t FindFixBin(const char* label) const
 Find bin number with label.
 If the List of labels does not exist or the label doe not exist just return -1 .
 Do not attempt to modify the axis. This is different than FindBin
Int_t FindFixBin(Double_t x) const
 Find bin number corresponding to abscissa x

 Identical to TAxis::FindBin except that if x is an underflow/overflow
 no attempt is made to extend the axis.
const char * GetBinLabel(Int_t bin) const
 Return label for bin
Int_t GetFirst() const
             return first bin on the axis
       ie 1 if no range defined
       NOTE: in some cases a zero is returned (see TAxis::SetRange)
Int_t GetLast() const
             return last bin on the axis
       ie fNbins if no range defined
       NOTE: in some cases a zero is returned (see TAxis::SetRange)
Double_t GetBinCenter(Int_t bin) const
 Return center of bin
Double_t GetBinCenterLog(Int_t bin) const
 Return center of bin in log
 With a log-equidistant binning for a bin with low and up edges, the mean is :
 0.5*(ln low + ln up) i.e. sqrt(low*up) in logx (e.g. sqrt(10^0*10^2) = 10).
Imagine a bin with low=1 and up=100 :
 - the center in lin is (100-1)/2=50.5
 - the center in log would be sqrt(1*100)=10 (!=log(50.5))
 NB: if the low edge of the bin is negative, the function returns the bin center
     as computed by TAxis::GetBinCenter
Double_t GetBinLowEdge(Int_t bin) const
 Return low edge of bin
Double_t GetBinUpEdge(Int_t bin) const
 Return up edge of bin
Double_t GetBinWidth(Int_t bin) const
 Return bin width
void GetCenter(Double_t* center) const
 Return an array with the center of all bins
void GetLowEdge(Double_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)
Bool_t HasBinWithoutLabel() const
 this helper function checks if there is a bin without a label
 if all bins have labels, the axis can / will become alphanumeric
void LabelsOption(Option_t* option = "h")
  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)
void ImportAttributes(const TAxis* axis)
 Copy axis attributes to this
void SaveAttributes(ostream& out, const char* name, const char* subname)
 Save axis attributes as C++ statement(s) on output stream out
void Set(Int_t nbins, Double_t xmin, Double_t xmax)
 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 Double_t* xbins)
 Initialize axis with variable bins
void SetAlphanumeric(Bool_t alphanumeric = kTRUE)
void SetDefaults()
 Set axis default values (from TStyle)
void SetBinLabel(Int_t bin, const char* label)
 Set label for bin
 If no label list exists, it is created. If all the bins have labels, the
 axis becomes alphanumeric and extendable.
 New labels will not be added with the Fill method but will end-up in the
 underflow bin. See documentation of TAxis::FindBin(const char*)
void SetRange(Int_t first = 0, Int_t last = 0)
  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(Double_t ufirst, Double_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* format = "")
 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 = "local")
 Change the time offset
 If option = "gmt", set display mode to GMT.
void Streamer(TBuffer& )
 Stream an object of class TAxis.
void UnZoom()
 Reset first & last bin to the full range
void ZoomOut(Double_t factor = 0, Double_t offset = 0)
 Zoom out by a factor of 'factor' (default =2)
   uses previous zoom factor by default
 Keep center defined by 'offset' fixed
   ie. -1 at left of current range, 0 in center, +1 at right
void CenterLabels(Bool_t center = kTRUE)
void CenterTitle(Bool_t center = kTRUE)
void RotateTitle(Bool_t rotate = kTRUE)
void SetDecimals(Bool_t dot = kTRUE)
void SetMoreLogLabels(Bool_t more = kTRUE)
void SetNoExponent(Bool_t noExponent = kTRUE)
Bool_t IsAlphanumeric()
{ return fBits2 & kAlphanumeric; }
Bool_t CanBeAlphanumeric()
{ return !(fBits2 & kNotAlpha); }
Bool_t CanExtend() const
{ return (fBits2 & kCanExtend); }
void SetCanExtend(Bool_t canExtend)
{ fBits2 = canExtend ? (fBits2 | kCanExtend) : (fBits2 & ~kCanExtend); }
void SetNoAlphanumeric(Bool_t noalpha = kTRUE)
void Delete(Option_t* = "")
{ }
TObject * DrawClone(Option_t* = "") const
{return 0;}
Int_t FindBin(Double_t x)
Bool_t GetCenterLabels() const
{ return TestBit(kCenterLabels); }
Bool_t GetCenterTitle() const
{ return TestBit(kCenterTitle); }
Bool_t GetDecimals() const
{ return TestBit(kDecimals); }
THashList * GetLabels() const
{ return fLabels; }
Bool_t GetMoreLogLabels() const
{ return TestBit(kMoreLogLabels); }
Int_t GetNbins() const
{ return fNbins; }
Bool_t GetNoExponent() const
{ return TestBit(kNoExponent); }
TObject * GetParent() const
{return fParent;}
Bool_t GetRotateTitle() const
{ return TestBit(kRotateTitle); }
Bool_t GetTimeDisplay() const
{return fTimeDisplay;}
const char * GetTimeFormat() const
{return fTimeFormat.Data();}
const char * GetTitle() const
{return fTitle.Data();}
const TArrayD * GetXbins() const
{return &fXbins;}
Double_t GetXmin() const
{return fXmin;}
Double_t GetXmax() const
{return fXmax;}
Bool_t IsVariableBinSize() const
 true if axis has variable bin sizes, false otherwise
void SetDrawOption(Option_t* = "")
{ }
void SetLimits(Double_t xmin, Double_t xmax)
{ /* set axis limits */ fXmin = xmin; fXmax = xmax; }
void SetParent(TObject* obj)
{fParent = obj;}
void SetTimeDisplay(Int_t value)
{fTimeDisplay = (value != 0);}