Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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
19class TF1;
20class TAxis;
21class TLatex;
22class TAxisModLab;
23
24class TGaxis : public TLine, public TAttText {
25
26protected:
27
28 Double_t fWmin; ///< Lowest value on the axis
29 Double_t fWmax; ///< Highest value on the axis
30 Float_t fGridLength; ///< Length of the grid in NDC
31 Float_t fTickSize; ///< Size of primary tick mark in NDC
32 Float_t fLabelOffset; ///< Offset of label wrt axis
33 Float_t fLabelSize; ///< Size of labels in NDC
34 Float_t fTitleOffset; ///< Offset of title wrt axis
35 Float_t fTitleSize; ///< Size of title in NDC
36 Int_t fNdiv; ///< Number of divisions
37 Int_t fLabelColor; ///< Color for labels
38 Int_t fLabelFont; ///< Font for labels
39 Int_t fNModLabs; ///< Number of modified labels
40 TString fChopt; ///< Axis options
41 TString fName; ///< Axis name
42 TString fTitle; ///< Axis title
43 TString fTimeFormat; ///< Time format, ex: 09/12/99 12:34:00
44 TString fFunctionName; ///< Name of mapping function pointed by fFunction
45 TF1 *fFunction; ///<! Pointer to function computing axis values
46 TAxis *fAxis; ///<! Pointer to original TAxis axis (if any)
47 TList *fModLabs; ///< List of modified labels.
48
49 TGaxis(const TGaxis&);
50 TGaxis& operator=(const TGaxis&);
51
52 Bool_t IsOwnedModLabs() const;
53 void CleanupModLabs();
54
55 TAxisModLab *FindModLab(Int_t indx, Int_t numlabels = 0, Double_t v = 0., Double_t eps = -1.) const;
56
57public:
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 ~TGaxis() override;
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, Double_t value = 0., Double_t eps = -1.);
74 Double_t wmin,Double_t wmax,Int_t ndiv=510, Option_t *chopt="",
75 Double_t gridlength = 0);
77 TF1 *GetFunction() const {return fFunction;}
79 Int_t GetLabelFont() const {return fLabelFont;}
84 const char *GetName() const override {return fName.Data();}
85 const char *GetOption() const override {return fChopt.Data();}
86 const char *GetTitle() const override {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 void Paint(Option_t *chopt="") override;
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);
101 void SavePrimitive(std::ostream &out, Option_t *option = "") override;
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 const TString &labText = ""); // *MENU*
112 void ChangeLabelByValue(Double_t labValue, Double_t labAngle = -1.,
113 Double_t labSize = -1., Int_t labAlign = -1,
114 Int_t labColor = -1 , Int_t labFont = -1,
115 const TString &labText = ""); // *MENU*
116 static void SetMaxDigits(Int_t maxd=5);
117 virtual void SetName(const char *name); // *MENU*
118 virtual void SetNdivisions(Int_t ndiv) {fNdiv = ndiv;} // *MENU*
119 virtual void SetMoreLogLabels(Bool_t more=kTRUE); // *MENU*
120 virtual void SetNoExponent(Bool_t noExponent=kTRUE); // *MENU*
121 virtual void SetDecimals(Bool_t dot=kTRUE); // *MENU*
122 void SetTickSize(Float_t ticksize) {fTickSize = ticksize;} // *MENU*
123 void SetTickLength(Float_t ticklength) {SetTickSize(ticklength);}
124 void SetGridLength(Float_t gridlength) {fGridLength = gridlength;}
125 void SetTimeFormat(const char *tformat);
126 void SetTimeOffset(Double_t toffset, Option_t *option="local");
127 virtual void SetTitle(const char *title=""); // *MENU*
128 void SetTitleOffset(Float_t titleoffset=1) {fTitleOffset = titleoffset;} // *MENU*
129 void SetTitleSize(Float_t titlesize) {fTitleSize = titlesize;} // *MENU*
130 void SetTitleFont(Int_t titlefont) {SetTextFont(titlefont);} // *MENU*
131 void SetTitleColor(Int_t titlecolor) {SetTextColor(titlecolor);} // *MENU*
134 static void SetExponentOffset(Float_t xoff=0., Float_t yoff=0., Option_t *axis="xy");
135
136 ClassDefOverride(TGaxis,6) //Graphics axis
137};
138
139#endif
#define c(i)
Definition RSha256.hxx:101
bool Bool_t
Definition RtypesCore.h:63
int Int_t
Definition RtypesCore.h:45
float Float_t
Definition RtypesCore.h:57
constexpr Bool_t kFALSE
Definition RtypesCore.h:101
double Double_t
Definition RtypesCore.h:59
constexpr Bool_t kTRUE
Definition RtypesCore.h:100
const char Option_t
Definition RtypesCore.h:66
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
#define X(type, name)
Option_t Option_t option
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t wmin
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
Option_t Option_t SetTextFont
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t wmax
char name[80]
Definition TGX11.cxx:110
float xmin
float ymin
float xmax
float ymax
Text Attributes class.
Definition TAttText.h:18
virtual void SetTextColor(Color_t tcolor=1)
Set the text color.
Definition TAttText.h:44
TAxis helper class used to store the modified labels.
Definition TAxisModLab.h:21
Class to manage histogram axis.
Definition TAxis.h:31
1-Dim function class
Definition TF1.h:214
The axis painter class.
Definition TGaxis.h:24
virtual void SetNoExponent(Bool_t noExponent=kTRUE)
Set the NoExponent flag.
Definition TGaxis.cxx:2925
void SetTimeFormat(const char *tformat)
Change the format used for time plotting.
Definition TGaxis.cxx:2969
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:1008
TGaxis()
TGaxis default constructor.
Definition TGaxis.cxx:694
void SetTitleOffset(Float_t titleoffset=1)
Definition TGaxis.h:128
void ChangeLabelAttributes(Int_t i, Int_t nlabels, TLatex *t, char *c, Double_t value=0., Double_t eps=-1.)
Helper method used by TGaxis::ChangeLabel.
Definition TGaxis.cxx:2859
Float_t fTitleSize
Size of title in NDC.
Definition TGaxis.h:35
Float_t GetGridLength() const
Definition TGaxis.h:76
void SetLabelFont(Int_t labelfont)
Definition TGaxis.h:105
void SetTitleSize(Float_t titlesize)
Definition TGaxis.h:129
Double_t GetWmin() const
Definition TGaxis.h:89
Float_t fTitleOffset
Offset of title wrt axis.
Definition TGaxis.h:34
const char * GetOption() const override
Definition TGaxis.h:85
TString fTitle
Axis title.
Definition TGaxis.h:42
Int_t fLabelFont
Font for labels.
Definition TGaxis.h:38
void SetTitleFont(Int_t titlefont)
Definition TGaxis.h:130
TAxisModLab * FindModLab(Int_t indx, Int_t numlabels=0, Double_t v=0., Double_t eps=-1.) const
Search for axis modifier by index or value.
Definition TGaxis.cxx:2662
virtual void SetTitle(const char *title="")
Change the title of the axis.
Definition TGaxis.cxx:2942
Int_t fLabelColor
Color for labels.
Definition TGaxis.h:37
TAxis * fAxis
! Pointer to original TAxis axis (if any)
Definition TGaxis.h:46
TString fTimeFormat
Time format, ex: 09/12/99 12:34:00.
Definition TGaxis.h:43
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save primitive as a C++ statement(s) on output stream out.
Definition TGaxis.cxx:2555
TString fFunctionName
Name of mapping function pointed by fFunction.
Definition TGaxis.h:44
void SetLabelOffset(Float_t labeloffset)
Definition TGaxis.h:106
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:2545
Float_t GetLabelOffset() const
Definition TGaxis.h:80
void SetTimeOffset(Double_t toffset, Option_t *option="local")
Change the time offset. If option = "gmt", set display mode to GMT.
Definition TGaxis.cxx:2993
Float_t fTickSize
Size of primary tick mark in NDC.
Definition TGaxis.h:31
void ChangeLabelByValue(Double_t labValue, Double_t labAngle=-1., Double_t labSize=-1., Int_t labAlign=-1, Int_t labColor=-1, Int_t labFont=-1, const TString &labText="")
Define new text attributes for the label value "labValue".
Definition TGaxis.cxx:2813
~TGaxis() override
TGaxis default destructor.
Definition TGaxis.cxx:861
TF1 * GetFunction() const
Definition TGaxis.h:77
virtual void ImportAxisAttributes(TAxis *axis)
Internal method to import TAxis attributes to this TGaxis.
Definition TGaxis.cxx:955
Int_t GetLabelFont() const
Definition TGaxis.h:79
Float_t fLabelOffset
Offset of label wrt axis.
Definition TGaxis.h:32
static void SetMaxDigits(Int_t maxd=5)
Static function to set fgMaxDigits for axis.
Definition TGaxis.cxx:2896
Float_t fLabelSize
Size of labels in NDC.
Definition TGaxis.h:33
Int_t fNdiv
Number of divisions.
Definition TGaxis.h:36
void SetGridLength(Float_t gridlength)
Definition TGaxis.h:124
const char * GetTitle() const override
Returns title of object.
Definition TGaxis.h:86
TString fChopt
Axis options.
Definition TGaxis.h:40
TGaxis & operator=(const TGaxis &)
Assignment operator.
Definition TGaxis.cxx:828
TString fName
Axis name.
Definition TGaxis.h:41
Float_t GetTitleOffset() const
Definition TGaxis.h:82
TF1 * fFunction
! Pointer to function computing axis values
Definition TGaxis.h:45
virtual void SetNdivisions(Int_t ndiv)
Definition TGaxis.h:118
void SetWmax(Double_t wmax)
Definition TGaxis.h:133
Float_t GetTitleSize() const
Definition TGaxis.h:83
static Int_t GetMaxDigits()
Static function returning gStyle->GetAxisMaxDigits().
Definition TGaxis.cxx:947
virtual void CenterLabels(Bool_t center=kTRUE)
If center = kTRUE axis labels are centered in the center of the bin.
Definition TGaxis.cxx:896
const char * GetName() const override
Returns name of object.
Definition TGaxis.h:84
void SetLabelColor(Int_t labelcolor)
Definition TGaxis.h:104
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:2498
void SetTickLength(Float_t ticklength)
Definition TGaxis.h:123
Float_t fGridLength
Length of the grid in NDC.
Definition TGaxis.h:30
Int_t GetLabelColor() const
Definition TGaxis.h:78
virtual void SetDecimals(Bool_t dot=kTRUE)
Set the decimals flag.
Definition TGaxis.cxx:2634
virtual void CenterTitle(Bool_t center=kTRUE)
If center = kTRUE axis title will be centered. The default is right adjusted.
Definition TGaxis.cxx:906
void SetTitleColor(Int_t titlecolor)
Definition TGaxis.h:131
TList * fModLabs
List of modified labels.
Definition TGaxis.h:47
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, const TString &labText="")
Define new text attributes for the label number "labNum".
Definition TGaxis.cxx:2734
void CleanupModLabs()
Correctly cleanup fModLabs - delete content when owned by TGaxis.
Definition TGaxis.cxx:881
Double_t fWmax
Highest value on the axis.
Definition TGaxis.h:29
Float_t GetTickSize() const
Definition TGaxis.h:91
virtual TGaxis * 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:916
virtual void SetMoreLogLabels(Bool_t more=kTRUE)
Set the kMoreLogLabels bit flag.
Definition TGaxis.cxx:2914
void SetWmin(Double_t wmin)
Definition TGaxis.h:132
void SetTickSize(Float_t ticksize)
Definition TGaxis.h:122
Int_t GetNdiv() const
Definition TGaxis.h:88
void Paint(Option_t *chopt="") override
Draw this axis with its current attributes.
Definition TGaxis.cxx:986
Int_t fNModLabs
Number of modified labels.
Definition TGaxis.h:39
Double_t fWmin
Lowest value on the axis.
Definition TGaxis.h:28
void SetLabelSize(Float_t labelsize)
Definition TGaxis.h:107
void SetFunction(const char *funcname="")
Specify a function to map the axis values.
Definition TGaxis.cxx:2643
virtual void SetName(const char *name)
Change the name of the axis.
Definition TGaxis.cxx:2904
static void SetExponentOffset(Float_t xoff=0., Float_t yoff=0., Option_t *axis="xy")
Static method to set X and Y offset of the axis 10^n notation.
Definition TGaxis.cxx:3035
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:2533
Double_t GetWmax() const
Definition TGaxis.h:90
Bool_t IsOwnedModLabs() const
Returns kTRUE when fModLabs owned by TGaxis and should be cleaned up.
Definition TGaxis.cxx:869
void ResetLabelAttributes(TLatex *t)
Helper method used by TGaxis::ChangeLabel.
Definition TGaxis.cxx:2880
Float_t GetLabelSize() const
Definition TGaxis.h:81
void SetOption(Option_t *option="")
To set axis options.
Definition TGaxis.cxx:2934
To draw Mathematical Formula.
Definition TLatex.h:18
Use the TLine constructor to create a simple line.
Definition TLine.h:22
A doubly linked list.
Definition TList.h:38
Basic string class.
Definition TString.h:139
const char * Data() const
Definition TString.h:380
Definition first.py:1