TGaxis


class description - source file - inheritance tree

class TGaxis : public TLine, public TAttText


    public:
TGaxis TGaxis() TGaxis TGaxis(Float_t xmin, Float_t ymin, Float_t xmax, Float_t ymax, Float_t wmin, Float_t wmax, Int_t ndiv = 510, Option_t* chopt, Float_t gridlength = 0) TGaxis TGaxis(TGaxis&) virtual void ~TGaxis() virtual void AdjustBinSize(Float_t A1, Float_t A2, Int_t nold, Float_t& BinLow, Float_t& BinHigh, Int_t& nbins, Float_t& BinWidth) virtual void CenterTitle(Bool_t center = kTRUE) TClass* Class() virtual void Draw(Option_t* chopt) virtual void DrawAxis(Float_t xmin, Float_t ymin, Float_t xmax, Float_t ymax, Float_t wmin, Float_t wmax, Int_t ndiv = 510, Option_t* chopt, Float_t gridlength = 0) Float_t GetGridLength() Int_t GetLabelFont() Float_t GetLabelOffset() Float_t GetLabelSize() virtual const Text_t* GetName() const Int_t GetNdiv() virtual const Text_t* GetOption() const Float_t GetTickSize() virtual const Text_t* GetTitle() const Float_t GetTitleOffset() Float_t GetTitleSize() Float_t GetWmax() Float_t GetWmin() virtual TClass* IsA() const void LabelsLimits(char* label, Int_t& first, Int_t& last) virtual void Optimize(Float_t A1, Float_t A2, Int_t nold, Float_t& BinLow, Float_t& BinHigh, Int_t& nbins, Float_t& BWID) virtual void Paint(Option_t* chopt) virtual void PaintAxis(Float_t xmin, Float_t ymin, Float_t xmax, Float_t ymax, Float_t& wmin, Float_t& wmax, Int_t& ndiv, Option_t* chopt, Float_t gridlength = 0) virtual void Rotate(Float_t X, Float_t Y, Float_t CFI, Float_t SFI, Float_t XT, Float_t YT, Float_t& U, Float_t& V) virtual void SavePrimitive(ofstream& out, Option_t* option) void SetGridLength(Float_t gridlength) void SetLabelFont(Int_t labelfont) void SetLabelOffset(Float_t labeloffset) void SetLabelSize(Float_t labelsize) virtual void SetName(Text_t* name) void SetOption(Option_t* option) void SetTickSize(Float_t ticksize) void SetTimeFormat(const char* tformat) virtual void SetTitle(const Text_t* title) void SetTitleOffset(Float_t titleoffset = 1) void SetTitleSize(Float_t titlesize) void SetWmax(Float_t wmax) void SetWmin(Float_t wmin) virtual void ShowMembers(TMemberInspector& insp, char* parent) virtual void Streamer(TBuffer& b)

Data Members

private:
Int_t fNdiv Number of divisions Float_t fWmin Lowest value on the axis Float_t fWmax Highest value on the axis Float_t fGridLength Length of the grid in NDC Float_t fTickSize Size of primary tick mark in NDC Float_t fLabelOffset Offset of label wrt axis Float_t fLabelSize Size of labels in NDC Float_t fTitleOffset Offset of title wrt axis Float_t fTitleSize Size of title in NDC Int_t fLabelFont Font for labels TString fChopt Axis options TString fName axis name TString fTitle axis title TString fTimeFormat Time format, ex: 09/12/99 12:34:00

Class Description

 Service class for the graphical representation of axis.
 Instances of this class are generated by the histogram classes and TGraph.

 The picture below has been generated by the following macro.
{

  gROOT.Reset();

  c1 = new TCanvas("c1","Examples of Gaxis",10,10,700,500);

  c1->Range(-10,-1,10,1);

  TGaxis *axis1 = new TGaxis(-4,-0.2,8,-0.2,-6,8,510,"");
  axis1->Draw();

  TGaxis *axis2 = new TGaxis(-4,0.2,8,0.2,0.001,10000,510,"G");
  axis2->Draw();

  TGaxis *axis3 = new TGaxis(-8,-0.8,-8,0.8,-8,8,50510,"");
  axis3->Draw();

  TGaxis *axis4 = new TGaxis(-6,-0.8,-6,0.8,1,10000,50510,"G");
  axis4->Draw();

  TGaxis *axis5 = new TGaxis(-4,-0.6,8,-0.6,1.2,1.32,80506,"-+");
  axis5->SetLabelSize(0.03);
  axis5->SetTextFont(72);
  axis5->SetLabelOffset(0.025);

  axis5->Draw();

  TGaxis *axis6 = new TGaxis(-4,0.6,8,0.6,100,900,50510,"-");
  axis6->Draw();
}

/*

*/



TGaxis(): TLine(), TAttText(11,0,1,62,0.040)
*-*-*-*-*-*-*-*-*-*-*Gaxis default constructor-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
*-*                  =========================

TGaxis(Float_t xmin, Float_t ymin, Float_t xmax, Float_t ymax, Float_t wmin, Float_t wmax, Int_t ndiv, Option_t *chopt, Float_t gridlength) : TLine(xmin,ymin,xmax,ymax), TAttText(11,0,1,62,0.040)
*-*-*-*-*-*-*-*-*-*-*Gaxis normal constructor-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
*-*                  =========================
  See explanation of parameters in PaintAxis


~TGaxis()
*-*-*-*-*-*-*-*-*-*-*Gaxis default destructor-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
*-*                  =======================

void CenterTitle(Bool_t center)
   if center = kTRUE axis title will be centered
   default is right adjusted

void Draw(Option_t *option)
*-*-*-*-*-*-*-*-*-*-*Draw this axis with its current attributes*-*-*-*-*-*-*
*-*                  ==========================================

void DrawAxis(Float_t xmin, Float_t ymin, Float_t xmax, Float_t ymax, Float_t wmin, Float_t wmax, Int_t ndiv, Option_t *chopt, Float_t gridlength)
*-*-*-*-*-*-*-*-*-*-*Draw this axis with new attributes*-*-*-*-*-*-*-*-*-*
*-*                  ==================================

void Paint(Option_t *)
*-*-*-*-*-*-*-*-*-*-*Draw this axis with its current attributes*-*-*-*-*-*-*
*-*                  ==========================================

void PaintAxis(Float_t xmin, Float_t ymin, Float_t xmax, Float_t ymax, Float_t &wmin, Float_t &wmax, Int_t &ndiv, Option_t *chopt, Float_t gridlength)
*-*-*-*-*-*-*-*-*-*-*-*Control function to draw an axis*-*-*-*-*-*-*-*-*-*-*
*-*                    ================================

============> Original authors (O.Couet C.E.Vandoni N.Cremel-Somon)
              largely modified and converted to C++ class by Rene Brun

 _Input parameters:

  xmin      : X origin coordinate in WC space.
  xmax      : X end axis coordinate in WC space.
  ymin      : Y origin coordinate in WC space.
  ymax      : Y end axis coordinate in WC space.
  wmin      : Lowest value for the tick mark
              labels written on the axis.
  wmax      : Highest value for the tick mark labels
              written on the axis.
  ndiv      : Number of divisions.

       ndiv=N1 + 100*N2 + 10000*N3
       N1=number of 1st divisions.
       N2=number of 2nd divisions.
       N3=number of 3rd divisions.
           e.g.:
           nndi=0 --> no tick marks.
           nndi=2 --> 2 divisions, one tick mark in the middle
                      of the axis.

  chopt :  Options (see below).

       chopt='G': loGarithmic scale, default is linear.
       chopt='B': Blank axis. Useful to superpose axis.

 Orientation of tick marks on axis.
 ----------------------------------

   Tick marks are normally drawn on the positive side of the axis,
   however, if X0=X1, then negative.

       chopt='+': tick marks are drawn on Positive side. (default)
       chopt='-': tick mark are drawn on the negative side.
       i.e: '+-' --> tick marks are drawn on both sides of the axis.
       chopt='U': Unlabeled axis, default is labeled.

 Position of labels on axis.
 ---------------------------

   Labels are normally drawn on side opposite to tick marks.
   However:

       chopt='=': on Equal side

 Orientation of labels on axis.
 ------------------------------

   Labels are normally drawn parallel to the axis.
   However if X0=X1, then Orthogonal
           if Y0=Y1, then Parallel

 Position of labels on tick marks.
 ---------------------------------

   Labels are centered on tick marks.
   However , if X0=X1, then they are right adjusted.

       chopt='R': labels are Right adjusted on tick mark.
                    (default is centered)
       chopt='L': labels are Left adjusted on tick mark.
       chopt='C': labels are Centered on tick mark.
       chopt='M': In the Middle of the divisions.

 Format of labels.
 -----------------

   Blank characters are stripped, and then the
   label is correctly aligned. the dot, if last
   character of the string, is also stripped.

   In the following, we have some parameters, like
   tick marks length and characters height (in percentage
   of the length of the axis (WC))
   The default values are as follows:

   Primary tick marks: 3.0 %
   Secondary tick marks: 1.5 %
   Third order tick marks: .75 %
   Characters height for labels: 4%

   Labels offset: 1.0 %

 Optional grid.
 --------------

       chopt='W': cross-Wire

 Axis bining optimization.
 -------------------------

   By default the axis bining is optimized .

       chopt='N': No bining optimization
       chopt='I': Integer labelling


 Time representation.
 --------------------

   Axis labels may be considered as times, plotted in
   a defined time format. The format id set with SetTimeFormat().

       chopt='t': Plot times with a defined format instead of values


void Optimize(Float_t A1, Float_t A2, Int_t nold ,Float_t &BinLow, Float_t &BinHigh, Int_t &nbins, Float_t &BinWidth)
*-*-*-*-*-*-*-*-*-*-*-*Reasonable Axis labels optimisation*-*-*-*-*-*-*-*-*
*-*                    ===================================
*-*  Get reasonable values for tick marks & ensure they are
*-*  not plotted beyond allowed limits
*-*
*-* _Input parameters:
*-*
*-*  A1,A2 : Old WMIN,WMAX .
*-*  BinLow,BinHigh : New WMIN,WMAX .
*-*  nold   : Old NDIV .
*-*  nbins    : New NDIV .
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

void AdjustBinSize(Float_t A1, Float_t A2, Int_t nold ,Float_t &BinLow, Float_t &BinHigh, Int_t &nbins, Float_t &BinWidth)
*-*-*-*-*-*-*-*-*-*-*-*Axis labels optimisation*-*-*-*-*-*-*-*-*-*-*-*-*-*
*-*                    ========================

   This routine adjusts the bining of the axis
   in order to have integer values for the labels

 _Input parameters:

  A1,A2    : Old WMIN,WMAX .
  BinLow,BinHigh : New WMIN,WMAX .
  nold     : Old NDIV (primary divisions)
  nbins    : New NDIV .


void LabelsLimits(char *label, Int_t &first, Int_t &last)
*-*-*-*-*-*-*-*-*Find first and last character of a label*-*-*-*-*-*-*-*-*-*
*-*              ========================================

void Rotate(Float_t X, Float_t Y, Float_t CFI, Float_t SFI ,Float_t XT, Float_t YT, Float_t &U, Float_t &V)
*-*-*-*-*-*-*-*-*-*-*-*-*-*Rotate axis coordinates*-*-*-*-*-*-*-*-*-*-*-*-*
*-*                        =======================

void SavePrimitive(ofstream &out, Option_t *)
 Save primitive as a C++ statement(s) on output stream out

void SetName(Text_t *name)
*-*-*-*-*-*-*-*-*-*-*Change the name of the axis*-*-*-*-*-*-*-*-*-*-*-*-*-*
*-*                  ============================

void SetOption(Option_t *option)
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*To set axis options*-*-*-*-*-*-*-*-*-*-*-*-*-*
*-*                          ===================

void SetTitle(const Text_t *title)
*-*-*-*-*-*-*-*-*-*-*Change the title of the axis*-*-*-*-*-*-*-*-*-*-*-*-*
*-*                  ============================

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)
      %% %



Inline Functions


              Float_t GetGridLength()
                Int_t GetLabelFont()
              Float_t GetLabelOffset()
              Float_t GetLabelSize()
              Float_t GetTitleOffset()
              Float_t GetTitleSize()
        const Text_t* GetName() const
        const Text_t* GetOption() const
        const Text_t* GetTitle() const
                Int_t GetNdiv()
              Float_t GetWmin()
              Float_t GetWmax()
              Float_t GetTickSize()
                 void SetLabelFont(Int_t labelfont)
                 void SetLabelOffset(Float_t labeloffset)
                 void SetLabelSize(Float_t labelsize)
                 void SetTickSize(Float_t ticksize)
                 void SetGridLength(Float_t gridlength)
                 void SetTitleOffset(Float_t titleoffset = 1)
                 void SetTitleSize(Float_t titlesize)
                 void SetWmin(Float_t wmin)
                 void SetWmax(Float_t wmax)
              TClass* Class()
              TClass* IsA() const
                 void ShowMembers(TMemberInspector& insp, char* parent)
                 void Streamer(TBuffer& b)
               TGaxis TGaxis(TGaxis&)


Author: Rene Brun, Olivier Couet 12/12/94
Last update: 2.23/08 30/10/99 11.54.10 by Rene Brun
Copyright (c) 1995-1999, The ROOT System, All rights reserved. *


ROOT page - Class index - 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.