Logo ROOT  
Reference Guide
TGaxis.h
Go to the documentation of this file.
1 // @(#)root/graf:$Id$
2 // Author: Rene Brun, Olivier Couet 12/12/94
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TGaxis
13 #define ROOT_TGaxis
14 
15 #include "TLine.h"
16 #include "TAttText.h"
17 #include "TString.h"
18 
19 class TF1;
20 class TAxis;
21 class TLatex;
22 
23 class TGaxis : public TLine, public TAttText {
24 
25 protected:
26 
27  Double_t fWmin; ///< Lowest value on the axis
28  Double_t fWmax; ///< Highest value on the axis
29  Float_t fGridLength; ///< Length of the grid in NDC
30  Float_t fTickSize; ///< Size of primary tick mark in NDC
31  Float_t fLabelOffset; ///< Offset of label wrt axis
32  Float_t fLabelSize; ///< Size of labels in NDC
33  Float_t fTitleOffset; ///< Offset of title wrt axis
34  Float_t fTitleSize; ///< Size of title in NDC
35  Int_t fNdiv; ///< Number of divisions
36  Int_t fLabelColor; ///< Color for labels
37  Int_t fLabelFont; ///< Font for labels
38  Int_t fNModLabs; ///< Number of modified labels
39  TString fChopt; ///< Axis options
40  TString fName; ///< Axis name
41  TString fTitle; ///< Axis title
42  TString fTimeFormat; ///< Time format, ex: 09/12/99 12:34:00
43  TString fFunctionName; ///< Name of mapping function pointed by fFunction
44  TF1 *fFunction; ///<! Pointer to function computing axis values
45  TAxis *fAxis; ///<! Pointer to original TAxis axis (if any)
46  TList *fModLabs; ///< List of modified labels.
47 
48  static Int_t fgMaxDigits; ///<! Number of digits above which the 10>N notation is used
49  static Float_t fXAxisExpXOffset; ///<! Exponent X offset for the X axis
50  static Float_t fXAxisExpYOffset; ///<! Exponent Y offset for the X axis
51  static Float_t fYAxisExpXOffset; ///<! Exponent X offset for the Y axis
52  static Float_t fYAxisExpYOffset; ///<! Exponent Y offset for the Y axis
53 
54  TGaxis(const TGaxis&);
55  TGaxis& operator=(const TGaxis&);
56 
57 public:
58 
59  TGaxis();
61  Double_t wmin,Double_t wmax,Int_t ndiv=510, Option_t *chopt="",
62  Double_t gridlength = 0);
64  const char *funcname, Int_t ndiv=510, Option_t *chopt="",
65  Double_t gridlength = 0);
66  virtual ~TGaxis();
67 
68  virtual void AdjustBinSize(Double_t A1, Double_t A2, Int_t nold
69  ,Double_t &BinLow, Double_t &BinHigh, Int_t &nbins, Double_t &BinWidth);
70  virtual void CenterLabels(Bool_t center=kTRUE);
71  virtual void CenterTitle(Bool_t center=kTRUE);
72  void ChangeLabelAttributes(Int_t i, Int_t nlabels, TLatex* t, char* c);
74  Double_t wmin,Double_t wmax,Int_t ndiv=510, Option_t *chopt="",
75  Double_t gridlength = 0);
76  Float_t GetGridLength() const {return fGridLength;}
77  TF1 *GetFunction() const {return fFunction;}
78  Int_t GetLabelColor() const {return fLabelColor;}
79  Int_t GetLabelFont() const {return fLabelFont;}
81  Float_t GetLabelSize() const {return fLabelSize;}
83  Float_t GetTitleSize() const {return fTitleSize;}
84  virtual const char *GetName() const {return fName.Data();}
85  virtual const char *GetOption() const {return fChopt.Data();}
86  virtual const char *GetTitle() const {return fTitle.Data();}
87  static Int_t GetMaxDigits();
88  Int_t GetNdiv() const {return fNdiv;}
89  Double_t GetWmin() const {return fWmin;}
90  Double_t GetWmax() const {return fWmax;}
91  Float_t GetTickSize() const {return fTickSize;}
92  virtual void ImportAxisAttributes(TAxis *axis);
93  void LabelsLimits(const char *label, Int_t &first, Int_t &last);
94  virtual void Paint(Option_t *chopt="");
96  Double_t &wmin,Double_t &wmax,Int_t &ndiv, Option_t *chopt="",
97  Double_t gridlength = 0, Bool_t drawGridOnly = kFALSE);
98  virtual void Rotate(Double_t X, Double_t Y, Double_t CFI, Double_t SFI
99  ,Double_t XT, Double_t YT, Double_t &U, Double_t &V);
100  void ResetLabelAttributes(TLatex* t);
101  virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
102  void SetFunction(const char *funcname="");
103  void SetOption(Option_t *option="");
104  void SetLabelColor(Int_t labelcolor) {fLabelColor = labelcolor;} // *MENU*
105  void SetLabelFont(Int_t labelfont) {fLabelFont = labelfont;} // *MENU*
106  void SetLabelOffset(Float_t labeloffset) {fLabelOffset = labeloffset;} // *MENU*
107  void SetLabelSize(Float_t labelsize) {fLabelSize = labelsize;} // *MENU*
108  void ChangeLabel(Int_t labNum=0, Double_t labAngle = -1.,
109  Double_t labSize = -1., Int_t labAlign = -1,
110  Int_t labColor = -1 , Int_t labFont = -1,
111  TString labText = ""); // *MENU*
112  static void SetMaxDigits(Int_t maxd=5);
113  virtual void SetName(const char *name); // *MENU*
114  virtual void SetNdivisions(Int_t ndiv) {fNdiv = ndiv;} // *MENU*
115  virtual void SetMoreLogLabels(Bool_t more=kTRUE); // *MENU*
116  virtual void SetNoExponent(Bool_t noExponent=kTRUE); // *MENU*
117  virtual void SetDecimals(Bool_t dot=kTRUE); // *MENU*
118  void SetTickSize(Float_t ticksize) {fTickSize = ticksize;} // *MENU*
119  void SetTickLength(Float_t ticklength) {SetTickSize(ticklength);}
120  void SetGridLength(Float_t gridlength) {fGridLength = gridlength;}
121  void SetTimeFormat(const char *tformat);
122  void SetTimeOffset(Double_t toffset, Option_t *option="local");
123  virtual void SetTitle(const char *title=""); // *MENU*
124  void SetTitleOffset(Float_t titleoffset=1) {fTitleOffset = titleoffset;} // *MENU*
125  void SetTitleSize(Float_t titlesize) {fTitleSize = titlesize;} // *MENU*
126  void SetTitleFont(Int_t titlefont) {SetTextFont(titlefont);} // *MENU*
127  void SetTitleColor(Int_t titlecolor) {SetTextColor(titlecolor);} // *MENU*
128  void SetWmin(Double_t wmin) {fWmin = wmin;}
129  void SetWmax(Double_t wmax) {fWmax = wmax;}
130  static void SetExponentOffset(Float_t xoff=0., Float_t yoff=0., Option_t *axis="xy");
131 
132  ClassDef(TGaxis,6) //Graphics axis
133 };
134 
135 #endif
c
#define c(i)
Definition: RSha256.hxx:101
TAttText
Text Attributes class.
Definition: TAttText.h:18
TGaxis::CenterLabels
virtual void CenterLabels(Bool_t center=kTRUE)
If center = kTRUE axis labels are centered in the center of the bin.
Definition: TGaxis.cxx:845
TAxis
Class to manage histogram axis.
Definition: TAxis.h:30
first
Definition: first.py:1
ymax
float ymax
Definition: THbookFile.cxx:95
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:91
TGaxis::SetTimeOffset
void SetTimeOffset(Double_t toffset, Option_t *option="local")
Change the time offset. If option = "gmt", set display mode to GMT.
Definition: TGaxis.cxx:2746
TGaxis::SetWmin
void SetWmin(Double_t wmin)
Definition: TGaxis.h:128
TLine.h
TGaxis::fLabelColor
Int_t fLabelColor
Color for labels.
Definition: TGaxis.h:36
TGaxis::fWmin
Double_t fWmin
Lowest value on the axis.
Definition: TGaxis.h:27
TGaxis::SetTitleOffset
void SetTitleOffset(Float_t titleoffset=1)
Definition: TGaxis.h:124
TLine
A simple line.
Definition: TLine.h:22
TGaxis::GetNdiv
Int_t GetNdiv() const
Definition: TGaxis.h:88
TGaxis::SetWmax
void SetWmax(Double_t wmax)
Definition: TGaxis.h:129
Option_t
const char Option_t
Definition: RtypesCore.h:66
TGaxis::fYAxisExpXOffset
static Float_t fYAxisExpXOffset
! Exponent X offset for the Y axis
Definition: TGaxis.h:51
TString::Data
const char * Data() const
Definition: TString.h:369
TGaxis::SetGridLength
void SetGridLength(Float_t gridlength)
Definition: TGaxis.h:120
TGaxis::fGridLength
Float_t fGridLength
Length of the grid in NDC.
Definition: TGaxis.h:29
TGaxis::CenterTitle
virtual void CenterTitle(Bool_t center=kTRUE)
If center = kTRUE axis title will be centered. The default is right adjusted.
Definition: TGaxis.cxx:855
TAttText.h
TGaxis::SetTitleSize
void SetTitleSize(Float_t titlesize)
Definition: TGaxis.h:125
TAttText::SetTextColor
virtual void SetTextColor(Color_t tcolor=1)
Set the text color.
Definition: TAttText.h:43
TGaxis::fXAxisExpYOffset
static Float_t fXAxisExpYOffset
! Exponent Y offset for the X axis
Definition: TGaxis.h:50
xmax
float xmax
Definition: THbookFile.cxx:95
TGaxis::GetName
virtual const char * GetName() const
Returns name of object.
Definition: TGaxis.h:84
TGaxis::GetTitleSize
Float_t GetTitleSize() const
Definition: TGaxis.h:83
Float_t
float Float_t
Definition: RtypesCore.h:57
TGaxis::SetDecimals
virtual void SetDecimals(Bool_t dot=kTRUE)
Set the decimals flag.
Definition: TGaxis.cxx:2498
Int_t
int Int_t
Definition: RtypesCore.h:45
TGaxis::ResetLabelAttributes
void ResetLabelAttributes(TLatex *t)
Reset the label attributes to the value they have before the last call to ChangeLabelAttributes.
Definition: TGaxis.cxx:2632
TGaxis::GetWmax
Double_t GetWmax() const
Definition: TGaxis.h:90
TGaxis::SetLabelOffset
void SetLabelOffset(Float_t labeloffset)
Definition: TGaxis.h:106
TLatex
To draw Mathematical Formula.
Definition: TLatex.h:18
TGaxis::GetGridLength
Float_t GetGridLength() const
Definition: TGaxis.h:76
TGaxis::TGaxis
TGaxis()
TGaxis default constructor.
Definition: TGaxis.cxx:678
TGaxis::fTitleOffset
Float_t fTitleOffset
Offset of title wrt axis.
Definition: TGaxis.h:33
TGaxis::GetTitleOffset
Float_t GetTitleOffset() const
Definition: TGaxis.h:82
TGaxis::fFunctionName
TString fFunctionName
Name of mapping function pointed by fFunction.
Definition: TGaxis.h:43
TGaxis::Rotate
virtual void Rotate(Double_t X, Double_t Y, Double_t CFI, Double_t SFI, Double_t XT, Double_t YT, Double_t &U, Double_t &V)
Internal method to rotate axis coordinates.
Definition: TGaxis.cxx:2422
TString
Basic string class.
Definition: TString.h:136
TGaxis::fTimeFormat
TString fTimeFormat
Time format, ex: 09/12/99 12:34:00.
Definition: TGaxis.h:42
TGaxis::SetMaxDigits
static void SetMaxDigits(Int_t maxd=5)
Static function to set fgMaxDigits for axis.
Definition: TGaxis.cxx:2648
Bool_t
bool Bool_t
Definition: RtypesCore.h:63
TGaxis::Paint
virtual void Paint(Option_t *chopt="")
Draw this axis with its current attributes.
Definition: TGaxis.cxx:933
TString.h
bool
TGaxis::ImportAxisAttributes
virtual void ImportAxisAttributes(TAxis *axis)
Internal method to import TAxis attributes to this TGaxis.
Definition: TGaxis.cxx:904
TGaxis::SetNoExponent
virtual void SetNoExponent(Bool_t noExponent=kTRUE)
Set the NoExponent flag.
Definition: TGaxis.cxx:2678
TGaxis::SetTickSize
void SetTickSize(Float_t ticksize)
Definition: TGaxis.h:118
TGaxis::GetLabelOffset
Float_t GetLabelOffset() const
Definition: TGaxis.h:80
TGaxis::operator=
TGaxis & operator=(const TGaxis &)
Assignment operator.
Definition: TGaxis.cxx:803
TGaxis::SetNdivisions
virtual void SetNdivisions(Int_t ndiv)
Definition: TGaxis.h:114
TGaxis::ChangeLabel
void ChangeLabel(Int_t labNum=0, Double_t labAngle=-1., Double_t labSize=-1., Int_t labAlign=-1, Int_t labColor=-1, Int_t labFont=-1, TString labText="")
Define new text attributes for the label number "labNum".
Definition: TGaxis.cxx:2560
TGaxis::fTitleSize
Float_t fTitleSize
Size of title in NDC.
Definition: TGaxis.h:34
TGaxis::GetFunction
TF1 * GetFunction() const
Definition: TGaxis.h:77
TGaxis::fChopt
TString fChopt
Axis options.
Definition: TGaxis.h:39
xmin
float xmin
Definition: THbookFile.cxx:95
TGaxis::fNdiv
Int_t fNdiv
Number of divisions.
Definition: TGaxis.h:35
TGaxis::SetName
virtual void SetName(const char *name)
Change the name of the axis.
Definition: TGaxis.cxx:2657
TGaxis::SetMoreLogLabels
virtual void SetMoreLogLabels(Bool_t more=kTRUE)
Set the kMoreLogLabels bit flag.
Definition: TGaxis.cxx:2667
TGaxis::fTickSize
Float_t fTickSize
Size of primary tick mark in NDC.
Definition: TGaxis.h:30
TGaxis::GetLabelFont
Int_t GetLabelFont() const
Definition: TGaxis.h:79
TGaxis::AdjustBinSize
virtual void AdjustBinSize(Double_t A1, Double_t A2, Int_t nold, Double_t &BinLow, Double_t &BinHigh, Int_t &nbins, Double_t &BinWidth)
Internal method for axis labels optimisation.
Definition: TGaxis.cxx:2375
TGaxis::SetOption
void SetOption(Option_t *option="")
To set axis options.
Definition: TGaxis.cxx:2687
TGaxis::GetOption
virtual const char * GetOption() const
Definition: TGaxis.h:85
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:92
TGaxis::SetTitleColor
void SetTitleColor(Int_t titlecolor)
Definition: TGaxis.h:127
TGaxis::fNModLabs
Int_t fNModLabs
Number of modified labels.
Definition: TGaxis.h:38
TGaxis::SetLabelFont
void SetLabelFont(Int_t labelfont)
Definition: TGaxis.h:105
TGaxis::fgMaxDigits
static Int_t fgMaxDigits
! Number of digits above which the 10>N notation is used
Definition: TGaxis.h:48
TGaxis::SetLabelSize
void SetLabelSize(Float_t labelsize)
Definition: TGaxis.h:107
TGaxis::GetMaxDigits
static Int_t GetMaxDigits()
Static function returning fgMaxDigits (See SetMaxDigits).
Definition: TGaxis.cxx:895
TGaxis::fLabelSize
Float_t fLabelSize
Size of labels in NDC.
Definition: TGaxis.h:32
TGaxis::fModLabs
TList * fModLabs
List of modified labels.
Definition: TGaxis.h:46
TGaxis::SetLabelColor
void SetLabelColor(Int_t labelcolor)
Definition: TGaxis.h:104
TGaxis::PaintAxis
virtual void PaintAxis(Double_t xmin, Double_t ymin, Double_t xmax, Double_t ymax, Double_t &wmin, Double_t &wmax, Int_t &ndiv, Option_t *chopt="", Double_t gridlength=0, Bool_t drawGridOnly=kFALSE)
Control function to draw an axis.
Definition: TGaxis.cxx:954
ymin
float ymin
Definition: THbookFile.cxx:95
TGaxis::SetTitle
virtual void SetTitle(const char *title="")
Change the title of the axis.
Definition: TGaxis.cxx:2695
TGaxis::SetFunction
void SetFunction(const char *funcname="")
Specify a function to map the axis values.
Definition: TGaxis.cxx:2507
TGaxis::SetTitleFont
void SetTitleFont(Int_t titlefont)
Definition: TGaxis.h:126
TGaxis::SetExponentOffset
static void SetExponentOffset(Float_t xoff=0., Float_t yoff=0., Option_t *axis="xy")
Static function to set X and Y offset of the axis 10^n notation.
Definition: TGaxis.cxx:2786
Double_t
double Double_t
Definition: RtypesCore.h:59
TGaxis::fXAxisExpXOffset
static Float_t fXAxisExpXOffset
! Exponent X offset for the X axis
Definition: TGaxis.h:49
TGaxis::DrawAxis
virtual void DrawAxis(Double_t xmin, Double_t ymin, Double_t xmax, Double_t ymax, Double_t wmin, Double_t wmax, Int_t ndiv=510, Option_t *chopt="", Double_t gridlength=0)
Draw this axis with new attributes.
Definition: TGaxis.cxx:865
TGaxis
The axis painter class.
Definition: TGaxis.h:23
TGaxis::fWmax
Double_t fWmax
Highest value on the axis.
Definition: TGaxis.h:28
TGaxis::GetTickSize
Float_t GetTickSize() const
Definition: TGaxis.h:91
TGaxis::fYAxisExpYOffset
static Float_t fYAxisExpYOffset
! Exponent Y offset for the Y axis
Definition: TGaxis.h:52
TGaxis::GetLabelColor
Int_t GetLabelColor() const
Definition: TGaxis.h:78
TGaxis::fLabelOffset
Float_t fLabelOffset
Offset of label wrt axis.
Definition: TGaxis.h:31
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
TGaxis::ChangeLabelAttributes
void ChangeLabelAttributes(Int_t i, Int_t nlabels, TLatex *t, char *c)
Definition: TGaxis.cxx:2601
name
char name[80]
Definition: TGX11.cxx:110
TGaxis::fAxis
TAxis * fAxis
! Pointer to original TAxis axis (if any)
Definition: TGaxis.h:45
TGaxis::LabelsLimits
void LabelsLimits(const char *label, Int_t &first, Int_t &last)
Internal method to find first and last character of a label.
Definition: TGaxis.cxx:2410
TGaxis::SavePrimitive
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save primitive as a C++ statement(s) on output stream out.
Definition: TGaxis.cxx:2432
TGaxis::fName
TString fName
Axis name.
Definition: TGaxis.h:40
TGaxis::fFunction
TF1 * fFunction
! Pointer to function computing axis values
Definition: TGaxis.h:44
TGaxis::SetTickLength
void SetTickLength(Float_t ticklength)
Definition: TGaxis.h:119
TGaxis::fTitle
TString fTitle
Axis title.
Definition: TGaxis.h:41
TGaxis::GetWmin
Double_t GetWmin() const
Definition: TGaxis.h:89
TF1
1-Dim function class
Definition: TF1.h:213
TGaxis::fLabelFont
Int_t fLabelFont
Font for labels.
Definition: TGaxis.h:37
TGaxis::~TGaxis
virtual ~TGaxis()
TGaxis default destructor.
Definition: TGaxis.cxx:836
TGaxis::SetTimeFormat
void SetTimeFormat(const char *tformat)
Change the format used for time plotting.
Definition: TGaxis.cxx:2722
TAttText::SetTextFont
virtual void SetTextFont(Font_t tfont=62)
Set the text font.
Definition: TAttText.h:45
TGaxis::GetTitle
virtual const char * GetTitle() const
Returns title of object.
Definition: TGaxis.h:86
TList
A doubly linked list.
Definition: TList.h:44
int
TGaxis::GetLabelSize
Float_t GetLabelSize() const
Definition: TGaxis.h:81