The axis painter class.
Instances of this class are generated by the histograms and graphs painting classes when TAxis
are drawn. TGaxis
is the "painter class" of TAxis
. Therefore it is mainly used via TAxis
, even if is some occasion it can be used directly to draw an axis which is not part of a graph or an instance. For instance to draw an extra scale on a plot.
A TGaxis
is defined the following way:
Where:
The example below generates various kind of axis.
Instead of the wmin,wmax arguments of the normal definition, the name of a TF1
function can be specified. This function will be used to map the user coordinates to the axis values and ticks.
A TGaxis
is defined the following way:
Where:
It should be noted that func
is not defined in the user's coordinate space, but in the new TGaxis space. If x
is the original axis, w
the new axis, and w = f(x)
(for example, f
is a calibration function converting ADC channels x
to energy w
), then func
must be supplied as f^{-1}(w)
.
Examples:
Note that this functionality has some limitations and does not follow all the TGaxis setting. In particular the number of divisions or the maximum number digits do not apply.
By default axis are linear. To define a TGaxis
as logarithmic, it is enough to create it with the option "G"
.
When plotting an histogram or a graph the logarithmic scale can be set using:
gPad->SetLogx(1);
set the logarithmic scale on the X axisgPad->SetLogy(1);
set the logarithmic scale on the Y axisWhen the SetMoreLogLabels()
method is called more labels are drawn when in logarithmic scale and there is a small number of decades (less than 3).
To draw only the axis tick marks without the axis body, it is enough to specify the option "B"
. It useful to superpose axis.
To draw an arrow at the end of the axis use the option ">"
. To draw it at the beginning of the axis use the option "<"
. To draw it on both ends use "<>"
.
By default tick marks are drawn on the positive side of the axis, except for vertical axis for which the default is negative. The chop
parameter allows to control the tick marks orientation:
chopt = "+"
: tick marks are drawn on Positive side. (default)chopt ="-"
: tick mark are drawn on the negative side.chopt = "+-"
: tick marks are drawn on both sides of the axis.chopt = "U"
: Unlabelled axis, default is labeled.By default, tick marks have a length equal to 3 per cent of the axis length. When the option "S" is specified, the length of the tick marks is equal to fTickSize*axis_length
, where fTickSize
may be set via TGaxis::SetTickSize
.
When plotting an histogram h
the tick marks size can be changed using:
h->GetXaxis()->SetTickLength(0.02);
set the tick length for the X axisgStyle->SetTickLength(0.02,"x");
set the tick length for the X axis of all histograms drawn after this instruction.A good way to remove tick marks on an axis is to set the tick length to 0: h->GetXaxis()->SetTickLength(0.);
Labels are normally drawn on side opposite to tick marks. However the option "="
allows to draw them on the same side. The distance between the labels and the axis body can be changed with SetLabelOffset
.
By default axis labels are drawn parallel to the axis. However if the axis is vertical then are drawn perpendicular to the axis.
By default axis labels are centered on tick marks. However, for vertical axis, they are right adjusted. The chop
parameter allows to control the labels' position on tick marks:
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.Blank characters are stripped, and then the label is correctly aligned. the dot, if last character of the string, is also stripped, unless the option "."
(a dot, or period) is specified. if SetDecimals(kTRUE)
has been called all labels have the same number of decimals after the "."
The same is true if gStyle->SetStripDecimals(kFALSE)
has been called.
In the following, we have some parameters, like tick marks length and characters height (in percentage of the length of the axis (user's coordinates)) The default values are as follows:
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)
.
TGaxis::SetExponentOffset(Float_t xoff, Float_t yoff, Option_t *axis)
is static function to set X and Y offset of the axis 10^n notation. It is in % of the pad size. It can be negative. axis
specifies which axis ("x"
or/and "y"
), default is "x"
if axis = "xz"
set the two axes
Axis labels can be any alphanumeric character strings. Such axis can be produced only with histograms because the labels'definition is stored in TAxis
. The following example demonstrates how to create such labels.
Because the alphanumeric labels are usually longer that the numeric labels, their size is by default equal to 0.66666 * the_numeric_labels_size
.
After an axis has been created, TGaxis::ChangeLabel allows to define new text attributes for a given label. A fine tuning of the labels can be done. All the attributes can be changed as well as the text label itself.
When plotting an histogram or a graph the labels can be changed like in the following example which shows a way to produce \(\pi\)-axis :
By default the number of divisions on axis is optimised to show a coherent labelling of the main tick marks. The number of division (ndiv
) is a composite integer given by:
ndiv = N1 + 100*N2 + 10000*N3
N1
= number of 1st divisions.N2
= number of 2nd divisions.N3
= number of 3rd divisions.by default the value of N1
, N2
and N3
are maximum values. After optimisation the real number of divisions will be smaller or equal to these value. If one wants to bypass the optimisation, the option "N"
should be given when the TGaxis
is created. The option "I"
also act on the number of division as it will force an integer labelling of the axis.
On an histogram pointer h
the number of divisions can be set in different ways:.
h
. To avoid optimization the number of divisions should be negative (ie: -510); The first parameter is the number of division. If it is negative of if the second parameter is kFALSE then the number of divisions is not optimised. And other signature is also allowed:
The static method TGaxis::SetMaxDigits
sets the maximum number of digits permitted for the axis labels above which the notation with 10^N is used. For example, to accept 6 digits number like 900000 on an axis call TGaxis::SetMaxDigits(6)
. The default value is 5. fgMaxDigits
must be greater than 0. Warning: even when called on a particular TGaxis* instance, this static function changes globally the number of digits for all axes (X, Y, ...) in the canvas. If you want to change the maximum number of digits N only of the current TGaxis*, and not all the others, use axis->SetNdivisions(N*1000000 + (axis->GetNdiv()%1000000)) instead of axis->SetMaxDigits(N).
The option "W"
allows to draw a grid on the primary tick marks. In case of a log axis, the grid is only drawn for the primary tick marks if the number of secondary and tertiary divisions is 0. SetGridLength()
allows to define the length of the grid.
When plotting an histogram or a graph the grid can be set ON or OFF using:
gPad->SetGridy(1);
set the grid on the X axisgPad->SetGridx(1);
set the grid on the Y axisgPad->SetGrid(1,1);
set the grid on both axis.Histograms' axis can be defined as "time axis". To do that it is enough to activate the TAxis::SetTimeDisplay attribute on a given axis. If h
is an histogram, it is done the following way:
Two parameters can be adjusted in order to define time axis:
Defines the format of the labels along the time axis. It can be changed using the TAxis TAxis::SetTimeFormat. The time format is the one used by the C function strftime(). It's a string containing the following formatting characters:
The other characters are output as is. For example to have a format like dd/mm/yyyy
one should do:
This is a time in seconds in the UNIX standard UTC format (this is an universal time, not the local time), defining the starting date of an histogram axis. This date should be greater than 01/01/95 and is given in seconds. There are three ways to define the time offset:
If no time offset is defined for a particular axis, the default time offset will be used. In the example above, notice the usage of TDateTime to translate an explicit date into the time in seconds required by TAxis::SetTimeFormat.
The time offset can be specified using the control character F
after the normal time format. F is followed by the date in the format: yyyy-mm-dd hh:mm:ss
.
Example:
Notice that this date format is the same used by the TDateString function AsSQLString
. If needed, this function can be used to translate a time in seconds into a character string which can be appended after F
. If the time format is not specified (before `F), the automatic one will be used.
If a time axis has no specified time offset, the global time offset will be stored in the axis data structure.
The following example illustrates the various possibilities.
The histogram limits times in seconds. If wmin
and wmax
are the histogram limits, the time axis will spread around the time offset value from TimeOffset+wmin
to TimeOffset+wmax
. Until now all the examples had a lowest value equal to 0. The following example demonstrates how to define the histogram limits relatively to the time offset value.
Usually time axis are created automatically via histograms, but one may also want to draw a time axis outside an "histogram context". Therefore it is useful to understand how TGaxis works for such axis.
The time offset can be defined using one of the three methods described before. The time axis will spread around the time offset value. Actually it will go from TimeOffset+wmin
to TimeOffset+wmax
where wmin
and wmax
are the minimum and maximum values (in seconds) of the axis. Let's take again an example. Having defined "2003, February 28 at 12h" we would like to see the axis a day before and a day after. A TGaxis can be created the following way (a day has 86400 seconds):
the t
option (in lower case) means it is a "time axis". The axis goes form 100000 seconds before TimeOffset
and 150000 seconds after.
So the complete macro is:
Thanks to the TLatex directive #splitline
it is possible to write the time labels on two lines. In the previous example changing the SetTimeFormat
line by
will produce the following axis:
The following example shows time axis on a TGraph:
The following example compares what the system time function gmtime
and localtime
give with what gives TGaxis
. It can be used as referenced test to check if the time option of TGaxis
is working properly.
The following macro illustrates the use, with histograms axis, of the time mode on the axis with different time intervals and time formats.
Public Member Functions | |
TGaxis () | |
TGaxis default constructor. | |
TGaxis (Double_t xmin, Double_t ymin, Double_t xmax, Double_t ymax, const char *funcname, Int_t ndiv=510, Option_t *chopt="", Double_t gridlength=0) | |
Constructor with a TF1 to map axis values. | |
TGaxis (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) | |
TGaxis normal constructor. | |
~TGaxis () override | |
TGaxis default destructor. | |
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. | |
virtual void | CenterLabels (Bool_t center=kTRUE) |
If center = kTRUE axis labels are centered in the center of the bin. | |
virtual void | CenterTitle (Bool_t center=kTRUE) |
If center = kTRUE axis title will be centered. The default is right adjusted. | |
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". | |
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. | |
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". | |
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. | |
TF1 * | GetFunction () const |
Float_t | GetGridLength () const |
Int_t | GetLabelColor () const |
Int_t | GetLabelFont () const |
Float_t | GetLabelOffset () const |
Float_t | GetLabelSize () const |
const char * | GetName () const override |
Returns name of object. | |
Int_t | GetNdiv () const |
const char * | GetOption () const override |
Float_t | GetTickSize () const |
const char * | GetTitle () const override |
Returns title of object. | |
Float_t | GetTitleOffset () const |
Float_t | GetTitleSize () const |
Double_t | GetWmax () const |
Double_t | GetWmin () const |
virtual void | ImportAxisAttributes (TAxis *axis) |
Internal method to import TAxis attributes to this TGaxis. | |
TClass * | IsA () const override |
void | LabelsLimits (const char *label, Int_t &first, Int_t &last) |
Internal method to find first and last character of a label. | |
void | Paint (Option_t *chopt="") override |
Draw this axis with its current attributes. | |
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. | |
void | ResetLabelAttributes (TLatex *t) |
Helper method used by TGaxis::ChangeLabel. | |
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. | |
void | SavePrimitive (std::ostream &out, Option_t *option="") override |
Save primitive as a C++ statement(s) on output stream out. | |
virtual void | SetDecimals (Bool_t dot=kTRUE) |
Set the decimals flag. | |
void | SetFunction (const char *funcname="") |
Specify a function to map the axis values. | |
void | SetGridLength (Float_t gridlength) |
void | SetLabelColor (Int_t labelcolor) |
void | SetLabelFont (Int_t labelfont) |
void | SetLabelOffset (Float_t labeloffset) |
void | SetLabelSize (Float_t labelsize) |
virtual void | SetMoreLogLabels (Bool_t more=kTRUE) |
Set the kMoreLogLabels bit flag. | |
virtual void | SetName (const char *name) |
Change the name of the axis. | |
virtual void | SetNdivisions (Int_t ndiv) |
virtual void | SetNoExponent (Bool_t noExponent=kTRUE) |
Set the NoExponent flag. | |
void | SetOption (Option_t *option="") |
To set axis options. | |
void | SetTickLength (Float_t ticklength) |
void | SetTickSize (Float_t ticksize) |
void | SetTimeFormat (const char *tformat) |
Change the format used for time plotting. | |
void | SetTimeOffset (Double_t toffset, Option_t *option="local") |
Change the time offset. If option = "gmt", set display mode to GMT. | |
virtual void | SetTitle (const char *title="") |
Change the title of the axis. | |
void | SetTitleColor (Int_t titlecolor) |
void | SetTitleFont (Int_t titlefont) |
void | SetTitleOffset (Float_t titleoffset=1) |
void | SetTitleSize (Float_t titlesize) |
void | SetWmax (Double_t wmax) |
void | SetWmin (Double_t wmin) |
void | Streamer (TBuffer &) override |
Stream an object of class TGaxis. | |
void | StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b) |
Public Member Functions inherited from TLine | |
TLine () | |
TLine (const TLine &line) | |
Line copy constructor. | |
TLine (Double_t x1, Double_t y1, Double_t x2, Double_t y2) | |
Line normal constructor. | |
~TLine () override=default | |
void | Copy (TObject &line) const override |
Copy this line to line. | |
Int_t | DistancetoPrimitive (Int_t px, Int_t py) override |
Compute distance from point px,py to a line. | |
virtual TLine * | DrawLine (Double_t x1, Double_t y1, Double_t x2, Double_t y2) |
Draw this line with new coordinates. | |
virtual TLine * | DrawLineNDC (Double_t x1, Double_t y1, Double_t x2, Double_t y2) |
Draw this line with new coordinates in NDC. | |
void | ExecuteEvent (Int_t event, Int_t px, Int_t py) override |
Execute action corresponding to one event. | |
Rectangle_t | GetBBox () override |
Return the bounding Box of the Line. | |
TPoint | GetBBoxCenter () override |
Return the center of the BoundingBox as TPoint in pixels. | |
Double_t | GetX1 () const |
Double_t | GetX2 () const |
Double_t | GetY1 () const |
Double_t | GetY2 () const |
TClass * | IsA () const override |
Bool_t | IsHorizontal () |
Check whether this line is to be drawn horizontally. | |
Bool_t | IsVertical () |
Check whether this line is to be drawn vertically. | |
void | ls (Option_t *option="") const override |
List this line with its attributes. | |
TLine & | operator= (const TLine &src) |
Assignment operator. | |
void | Paint (Option_t *option="") override |
Paint this line with its current attributes. | |
virtual void | PaintLine (Double_t x1, Double_t y1, Double_t x2, Double_t y2) |
Draw this line with new coordinates. | |
virtual void | PaintLineNDC (Double_t u1, Double_t v1, Double_t u2, Double_t v2) |
Draw this line with new coordinates in NDC. | |
void | Print (Option_t *option="") const override |
Dump this line with its attributes. | |
void | SavePrimitive (std::ostream &out, Option_t *option="") override |
Save primitive as a C++ statement(s) on output stream out. | |
void | SetBBoxCenter (const TPoint &p) override |
Set center of the BoundingBox. | |
void | SetBBoxCenterX (const Int_t x) override |
Set X coordinate of the center of the BoundingBox. | |
void | SetBBoxCenterY (const Int_t y) override |
Set Y coordinate of the center of the BoundingBox. | |
void | SetBBoxX1 (const Int_t x) override |
Set left hand side of BoundingBox to a value (resize in x direction on left) | |
void | SetBBoxX2 (const Int_t x) override |
Set right hand side of BoundingBox to a value (resize in x direction on right) | |
void | SetBBoxY1 (const Int_t y) override |
Set top of BoundingBox to a value (resize in y direction on top) | |
void | SetBBoxY2 (const Int_t y) override |
Set bottom of BoundingBox to a value (resize in y direction on bottom) | |
void | SetHorizontal (Bool_t set=kTRUE) |
Force the line to be drawn horizontally. | |
virtual void | SetNDC (Bool_t isNDC=kTRUE) |
Set NDC mode on if isNDC = kTRUE, off otherwise. | |
void | SetVertical (Bool_t set=kTRUE) |
Force the line to be drawn vertically. | |
virtual void | SetX1 (Double_t x1) |
virtual void | SetX2 (Double_t x2) |
virtual void | SetY1 (Double_t y1) |
virtual void | SetY2 (Double_t y2) |
void | Streamer (TBuffer &) override |
Stream an object of class TLine. | |
void | StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b) |
Public Member Functions inherited from TObject | |
TObject () | |
TObject constructor. | |
TObject (const TObject &object) | |
TObject copy ctor. | |
virtual | ~TObject () |
TObject destructor. | |
void | AbstractMethod (const char *method) const |
Use this method to implement an "abstract" method that you don't want to leave purely abstract. | |
virtual void | AppendPad (Option_t *option="") |
Append graphics object to current pad. | |
virtual void | Browse (TBrowser *b) |
Browse object. May be overridden for another default action. | |
ULong_t | CheckedHash () |
Check and record whether this class has a consistent Hash/RecursiveRemove setup (*) and then return the regular Hash value for this object. | |
virtual const char * | ClassName () const |
Returns name of class to which the object belongs. | |
virtual void | Clear (Option_t *="") |
virtual TObject * | Clone (const char *newname="") const |
Make a clone of an object using the Streamer facility. | |
virtual Int_t | Compare (const TObject *obj) const |
Compare abstract method. | |
virtual void | Delete (Option_t *option="") |
Delete this object. | |
virtual void | Draw (Option_t *option="") |
Default Draw method for all objects. | |
virtual void | DrawClass () const |
Draw class inheritance tree of the class to which this object belongs. | |
virtual TObject * | DrawClone (Option_t *option="") const |
Draw a clone of this object in the current selected pad with: gROOT->SetSelectedPad(c1) . | |
virtual void | Dump () const |
Dump contents of object on stdout. | |
virtual void | Error (const char *method, const char *msgfmt,...) const |
Issue error message. | |
virtual void | Execute (const char *method, const char *params, Int_t *error=nullptr) |
Execute method on this object with the given parameter string, e.g. | |
virtual void | Execute (TMethod *method, TObjArray *params, Int_t *error=nullptr) |
Execute method on this object with parameters stored in the TObjArray. | |
virtual void | Fatal (const char *method, const char *msgfmt,...) const |
Issue fatal error message. | |
virtual TObject * | FindObject (const char *name) const |
Must be redefined in derived classes. | |
virtual TObject * | FindObject (const TObject *obj) const |
Must be redefined in derived classes. | |
virtual Option_t * | GetDrawOption () const |
Get option used by the graphics system to draw this object. | |
virtual const char * | GetIconName () const |
Returns mime type name of object. | |
virtual char * | GetObjectInfo (Int_t px, Int_t py) const |
Returns string containing info about the object at position (px,py). | |
virtual UInt_t | GetUniqueID () const |
Return the unique object id. | |
virtual Bool_t | HandleTimer (TTimer *timer) |
Execute action in response of a timer timing out. | |
virtual ULong_t | Hash () const |
Return hash value for this object. | |
Bool_t | HasInconsistentHash () const |
Return true is the type of this object is known to have an inconsistent setup for Hash and RecursiveRemove (i.e. | |
virtual void | Info (const char *method, const char *msgfmt,...) const |
Issue info message. | |
virtual Bool_t | InheritsFrom (const char *classname) const |
Returns kTRUE if object inherits from class "classname". | |
virtual Bool_t | InheritsFrom (const TClass *cl) const |
Returns kTRUE if object inherits from TClass cl. | |
virtual void | Inspect () const |
Dump contents of this object in a graphics canvas. | |
void | InvertBit (UInt_t f) |
Bool_t | IsDestructed () const |
IsDestructed. | |
virtual Bool_t | IsEqual (const TObject *obj) const |
Default equal comparison (objects are equal if they have the same address in memory). | |
virtual Bool_t | IsFolder () const |
Returns kTRUE in case object contains browsable objects (like containers or lists of other objects). | |
R__ALWAYS_INLINE Bool_t | IsOnHeap () const |
virtual Bool_t | IsSortable () const |
R__ALWAYS_INLINE Bool_t | IsZombie () const |
void | MayNotUse (const char *method) const |
Use this method to signal that a method (defined in a base class) may not be called in a derived class (in principle against good design since a child class should not provide less functionality than its parent, however, sometimes it is necessary). | |
virtual Bool_t | Notify () |
This method must be overridden to handle object notification (the base implementation is no-op). | |
void | Obsolete (const char *method, const char *asOfVers, const char *removedFromVers) const |
Use this method to declare a method obsolete. | |
void | operator delete (void *ptr) |
Operator delete. | |
void | operator delete (void *ptr, void *vp) |
Only called by placement new when throwing an exception. | |
void | operator delete[] (void *ptr) |
Operator delete []. | |
void | operator delete[] (void *ptr, void *vp) |
Only called by placement new[] when throwing an exception. | |
void * | operator new (size_t sz) |
void * | operator new (size_t sz, void *vp) |
void * | operator new[] (size_t sz) |
void * | operator new[] (size_t sz, void *vp) |
TObject & | operator= (const TObject &rhs) |
TObject assignment operator. | |
virtual void | Pop () |
Pop on object drawn in a pad to the top of the display list. | |
virtual Int_t | Read (const char *name) |
Read contents of object with specified name from the current directory. | |
virtual void | RecursiveRemove (TObject *obj) |
Recursively remove this object from a list. | |
void | ResetBit (UInt_t f) |
virtual void | SaveAs (const char *filename="", Option_t *option="") const |
Save this object in the file specified by filename. | |
void | SetBit (UInt_t f) |
void | SetBit (UInt_t f, Bool_t set) |
Set or unset the user status bits as specified in f. | |
virtual void | SetDrawOption (Option_t *option="") |
Set drawing option for object. | |
virtual void | SetUniqueID (UInt_t uid) |
Set the unique object id. | |
void | StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b) |
virtual void | SysError (const char *method, const char *msgfmt,...) const |
Issue system error message. | |
R__ALWAYS_INLINE Bool_t | TestBit (UInt_t f) const |
Int_t | TestBits (UInt_t f) const |
virtual void | UseCurrentStyle () |
Set current style settings in this object This function is called when either TCanvas::UseCurrentStyle or TROOT::ForceStyle have been invoked. | |
virtual void | Warning (const char *method, const char *msgfmt,...) const |
Issue warning message. | |
virtual Int_t | Write (const char *name=nullptr, Int_t option=0, Int_t bufsize=0) |
Write this object to the current directory. | |
virtual Int_t | Write (const char *name=nullptr, Int_t option=0, Int_t bufsize=0) const |
Write this object to the current directory. | |
Public Member Functions inherited from TAttLine | |
TAttLine () | |
AttLine default constructor. | |
TAttLine (Color_t lcolor, Style_t lstyle, Width_t lwidth) | |
AttLine normal constructor. | |
virtual | ~TAttLine () |
AttLine destructor. | |
void | Copy (TAttLine &attline) const |
Copy this line attributes to a new TAttLine. | |
Int_t | DistancetoLine (Int_t px, Int_t py, Double_t xp1, Double_t yp1, Double_t xp2, Double_t yp2) |
Compute distance from point px,py to a line. | |
virtual Color_t | GetLineColor () const |
Return the line color. | |
virtual Style_t | GetLineStyle () const |
Return the line style. | |
virtual Width_t | GetLineWidth () const |
Return the line width. | |
virtual void | Modify () |
Change current line attributes if necessary. | |
virtual void | ResetAttLine (Option_t *option="") |
Reset this line attributes to default values. | |
virtual void | SaveLineAttributes (std::ostream &out, const char *name, Int_t coldef=1, Int_t stydef=1, Int_t widdef=1) |
Save line attributes as C++ statement(s) on output stream out. | |
virtual void | SetLineAttributes () |
Invoke the DialogCanvas Line attributes. | |
virtual void | SetLineColor (Color_t lcolor) |
Set the line color. | |
virtual void | SetLineColorAlpha (Color_t lcolor, Float_t lalpha) |
Set a transparent line color. | |
virtual void | SetLineStyle (Style_t lstyle) |
Set the line style. | |
virtual void | SetLineWidth (Width_t lwidth) |
Set the line width. | |
void | StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b) |
Public Member Functions inherited from TAttBBox2D | |
virtual | ~TAttBBox2D () |
void | StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b) |
Public Member Functions inherited from TAttText | |
TAttText () | |
AttText default constructor. | |
TAttText (Int_t align, Float_t angle, Color_t color, Style_t font, Float_t tsize) | |
AttText normal constructor. | |
virtual | ~TAttText () |
AttText destructor. | |
void | Copy (TAttText &atttext) const |
Copy this text attributes to a new TAttText. | |
virtual Short_t | GetTextAlign () const |
Return the text alignment. | |
virtual Float_t | GetTextAngle () const |
Return the text angle. | |
virtual Color_t | GetTextColor () const |
Return the text color. | |
virtual Font_t | GetTextFont () const |
Return the text font. | |
virtual Float_t | GetTextSize () const |
Return the text size. | |
virtual Float_t | GetTextSizePercent (Float_t size) |
Return the text in percent of the pad size. | |
virtual void | Modify () |
Change current text attributes if necessary. | |
virtual void | ResetAttText (Option_t *toption="") |
Reset this text attributes to default values. | |
virtual void | SaveTextAttributes (std::ostream &out, const char *name, Int_t alidef=12, Float_t angdef=0, Int_t coldef=1, Int_t fondef=61, Float_t sizdef=1) |
Save text attributes as C++ statement(s) on output stream out. | |
virtual void | SetTextAlign (Short_t align=11) |
Set the text alignment. | |
virtual void | SetTextAngle (Float_t tangle=0) |
Set the text angle. | |
virtual void | SetTextAttributes () |
Invoke the DialogCanvas Text attributes. | |
virtual void | SetTextColor (Color_t tcolor=1) |
Set the text color. | |
virtual void | SetTextColorAlpha (Color_t tcolor, Float_t talpha) |
Set a transparent text color. | |
virtual void | SetTextFont (Font_t tfont=62) |
Set the text font. | |
virtual void | SetTextSize (Float_t tsize=1) |
Set the text size. | |
virtual void | SetTextSizePixels (Int_t npixels) |
Set the text size in pixel. | |
void | StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b) |
Static Public Member Functions | |
static TClass * | Class () |
static const char * | Class_Name () |
static constexpr Version_t | Class_Version () |
static const char * | DeclFileName () |
static Int_t | GetMaxDigits () |
Static function returning gStyle->GetAxisMaxDigits() . | |
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. | |
static void | SetMaxDigits (Int_t maxd=5) |
Static function to set fgMaxDigits for axis. | |
Static Public Member Functions inherited from TLine | |
static TClass * | Class () |
static const char * | Class_Name () |
static constexpr Version_t | Class_Version () |
static const char * | DeclFileName () |
Static Public Member Functions inherited from TObject | |
static TClass * | Class () |
static const char * | Class_Name () |
static constexpr Version_t | Class_Version () |
static const char * | DeclFileName () |
static Longptr_t | GetDtorOnly () |
Return destructor only flag. | |
static Bool_t | GetObjectStat () |
Get status of object stat flag. | |
static void | SetDtorOnly (void *obj) |
Set destructor only flag. | |
static void | SetObjectStat (Bool_t stat) |
Turn on/off tracking of objects in the TObjectTable. | |
Static Public Member Functions inherited from TAttLine | |
static TClass * | Class () |
static const char * | Class_Name () |
static constexpr Version_t | Class_Version () |
static const char * | DeclFileName () |
Static Public Member Functions inherited from TAttBBox2D | |
static TClass * | Class () |
static const char * | Class_Name () |
static constexpr Version_t | Class_Version () |
static const char * | DeclFileName () |
Static Public Member Functions inherited from TAttText | |
static TClass * | Class () |
static const char * | Class_Name () |
static constexpr Version_t | Class_Version () |
static const char * | DeclFileName () |
Protected Member Functions | |
TGaxis (const TGaxis &) | |
Copy constructor. | |
void | CleanupModLabs () |
Correctly cleanup fModLabs - delete content when owned by TGaxis. | |
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. | |
Bool_t | IsOwnedModLabs () const |
Returns kTRUE when fModLabs owned by TGaxis and should be cleaned up. | |
TGaxis & | operator= (const TGaxis &) |
Assignment operator. | |
Protected Member Functions inherited from TObject | |
virtual void | DoError (int level, const char *location, const char *fmt, va_list va) const |
Interface to ErrorHandler (protected). | |
void | MakeZombie () |
Protected Attributes | |
TAxis * | fAxis |
! Pointer to original TAxis axis (if any) | |
TString | fChopt |
Axis options. | |
TF1 * | fFunction |
! Pointer to function computing axis values | |
TString | fFunctionName |
Name of mapping function pointed by fFunction. | |
Float_t | fGridLength |
Length of the grid in NDC. | |
Int_t | fLabelColor |
Color for labels. | |
Int_t | fLabelFont |
Font for labels. | |
Float_t | fLabelOffset |
Offset of label wrt axis. | |
Float_t | fLabelSize |
Size of labels in NDC. | |
TList * | fModLabs |
List of modified labels. | |
TString | fName |
Axis name. | |
Int_t | fNdiv |
Number of divisions. | |
Int_t | fNModLabs |
Number of modified labels. | |
Float_t | fTickSize |
Size of primary tick mark in NDC. | |
TString | fTimeFormat |
Time format, ex: 09/12/99 12:34:00. | |
TString | fTitle |
Axis title. | |
Float_t | fTitleOffset |
Offset of title wrt axis. | |
Float_t | fTitleSize |
Size of title in NDC. | |
Double_t | fWmax |
Highest value on the axis. | |
Double_t | fWmin |
Lowest value on the axis. | |
Protected Attributes inherited from TLine | |
Double_t | fX1 {0} |
X of 1st point. | |
Double_t | fX2 {0} |
X of 2nd point. | |
Double_t | fY1 {0} |
Y of 1st point. | |
Double_t | fY2 {0} |
Y of 2nd point. | |
Protected Attributes inherited from TAttLine | |
Color_t | fLineColor |
Line color. | |
Style_t | fLineStyle |
Line style. | |
Width_t | fLineWidth |
Line width. | |
Protected Attributes inherited from TAttText | |
Short_t | fTextAlign |
Text alignment. | |
Float_t | fTextAngle |
Text angle. | |
Color_t | fTextColor |
Text color. | |
Font_t | fTextFont |
Text font. | |
Float_t | fTextSize |
Text size. | |
Additional Inherited Members | |
Public Types inherited from TLine | |
enum | { kLineNDC = (1ULL << ( 14 )) , kVertical = (1ULL << ( 15 )) , kHorizontal = (1ULL << ( 16 )) } |
Public Types inherited from TObject | |
enum | { kIsOnHeap = 0x01000000 , kNotDeleted = 0x02000000 , kZombie = 0x04000000 , kInconsistent = 0x08000000 , kBitMask = 0x00ffffff } |
enum | { kSingleKey = (1ULL << ( 0 )) , kOverwrite = (1ULL << ( 1 )) , kWriteDelete = (1ULL << ( 2 )) } |
enum | EDeprecatedStatusBits { kObjInCanvas = (1ULL << ( 3 )) } |
enum | EStatusBits { kCanDelete = (1ULL << ( 0 )) , kMustCleanup = (1ULL << ( 3 )) , kIsReferenced = (1ULL << ( 4 )) , kHasUUID = (1ULL << ( 5 )) , kCannotPick = (1ULL << ( 6 )) , kNoContextMenu = (1ULL << ( 8 )) , kInvalidObject = (1ULL << ( 13 )) } |
Protected Types inherited from TObject | |
enum | { kOnlyPrepStep = (1ULL << ( 3 )) } |
#include <TGaxis.h>
|
protected |
Copy constructor.
Definition at line 796 of file TGaxis.cxx.
TGaxis::TGaxis | ( | ) |
TGaxis default constructor.
Definition at line 694 of file TGaxis.cxx.
TGaxis::TGaxis | ( | 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 |
||
) |
TGaxis normal constructor.
Definition at line 722 of file TGaxis.cxx.
TGaxis::TGaxis | ( | Double_t | xmin, |
Double_t | ymin, | ||
Double_t | xmax, | ||
Double_t | ymax, | ||
const char * | funcname, | ||
Int_t | ndiv = 510 , |
||
Option_t * | chopt = "" , |
||
Double_t | gridlength = 0 |
||
) |
Constructor with a TF1
to map axis values.
func
(with name funcname
) is not defined in the user's coordinate space, but in the new TGaxis space. If x
is the original axis, w
the new axis, and w = f(x)
(for example, f
is a calibration function converting ADC channels x
to energy w
), then func
must be supplied as f^{-1}(w)
. Definition at line 759 of file TGaxis.cxx.
|
override |
TGaxis default destructor.
Definition at line 861 of file TGaxis.cxx.
|
virtual |
Internal method for axis labels optimisation.
This method adjusts the bining of the axis in order to have integer values for the labels.
[in] | A1,A2 | Old WMIN,WMAX |
[out] | binLow,binHigh | New WMIN,WMAX |
[in] | nold | Old NDIV (primary divisions) |
[out] | nbins | New NDIV |
[out] | binWidth | Bin width |
Definition at line 2498 of file TGaxis.cxx.
If center = kTRUE axis labels are centered in the center of the bin.
The default is to center on the primary tick marks. This option does not make sense if there are more bins than tick marks.
Definition at line 896 of file TGaxis.cxx.
If center = kTRUE axis title will be centered. The default is right adjusted.
Definition at line 906 of file TGaxis.cxx.
void TGaxis::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".
It allows to do a fine tuning of the labels. All the attributes can be changed, even the label text itself.
[in] | labNum | Number of the label to be changed, negative numbers start from the end |
[in] | labAngle | New angle value |
[in] | labSize | New size (0 erase the label) |
[in] | labAlign | New alignment value |
[in] | labColor | New label color |
[in] | labFont | New label font |
[in] | labText | New label text |
Definition at line 2734 of file TGaxis.cxx.
void TGaxis::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.
Change the label attributes of label number i. If needed.
[in] | i | Current label number to be changed if needed |
[in] | nlabels | Totals number of labels for this axis (useful when i is counted from the end) |
[in] | t | Original TLatex string holding the label to be changed |
[in] | c | Text string to be drawn |
[in] | value | Axis value which should be changed |
[in] | eps | Epsilon parameter for axis value, -1 means ignore axis value at all |
Definition at line 2859 of file TGaxis.cxx.
void TGaxis::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".
It allows to do a fine tuning of the labels. All the attributes can be changed, even the label text itself.
[in] | labValue | Axis value to be changed |
[in] | labAngle | New angle value |
[in] | labSize | New size (0 erase the label) |
[in] | labAlign | New alignment value |
[in] | labColor | New label color |
[in] | labFont | New label font |
[in] | labText | New label text |
Definition at line 2813 of file TGaxis.cxx.
|
static |
|
inlinestaticconstexpr |
|
protected |
Correctly cleanup fModLabs - delete content when owned by TGaxis.
Definition at line 881 of file TGaxis.cxx.
|
inlinestatic |
|
virtual |
Draw this axis with new attributes.
Definition at line 916 of file TGaxis.cxx.
|
protected |
Search for axis modifier by index or value.
Definition at line 2662 of file TGaxis.cxx.
|
static |
Static function returning gStyle->GetAxisMaxDigits()
.
Definition at line 947 of file TGaxis.cxx.
|
inlineoverridevirtual |
|
inlineoverridevirtual |
|
inlineoverridevirtual |
|
virtual |
Internal method to import TAxis attributes to this TGaxis.
Definition at line 955 of file TGaxis.cxx.
|
inlineoverridevirtual |
|
protected |
Returns kTRUE when fModLabs owned by TGaxis and should be cleaned up.
Definition at line 869 of file TGaxis.cxx.
Internal method to find first and last character of a label.
Definition at line 2533 of file TGaxis.cxx.
Assignment operator.
Definition at line 828 of file TGaxis.cxx.
|
overridevirtual |
Draw this axis with its current attributes.
Reimplemented from TObject.
Definition at line 986 of file TGaxis.cxx.
|
virtual |
Control function to draw an axis.
Original authors: O.Couet C.E.Vandoni N.Cremel-Somon. Modified and converted to C++ class by Rene Brun.
Definition at line 1008 of file TGaxis.cxx.
void TGaxis::ResetLabelAttributes | ( | TLatex * | t | ) |
Helper method used by TGaxis::ChangeLabel.
Reset the labels' attributes to the values they had before the last call to TGaxis::ChangeLabelAttributes.
Definition at line 2880 of file TGaxis.cxx.
|
virtual |
Internal method to rotate axis coordinates.
Definition at line 2545 of file TGaxis.cxx.
|
overridevirtual |
Save primitive as a C++ statement(s) on output stream out.
Reimplemented from TObject.
Definition at line 2555 of file TGaxis.cxx.
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)
. Note the bit is set in fBits (as opposed to fBits2 in TAxis!)
Definition at line 2634 of file TGaxis.cxx.
|
static |
Static method to set X and Y offset of the axis 10^n notation.
It applies on axis belonging to an histogram (TAxis). It has no effect on standalone TGaxis. It is in % of the pad size. It can be negative. axis specifies which axis ("x","y"), default = "x" if axis="xz" set the two axes Redirected to TStyle::SetExponentOffset
Definition at line 3035 of file TGaxis.cxx.
void TGaxis::SetFunction | ( | const char * | funcname = "" | ) |
Specify a function to map the axis values.
Definition at line 2643 of file TGaxis.cxx.
|
static |
Static function to set fgMaxDigits
for axis.
fgMaxDigits
is the maximum number of digits permitted for the axis labels above which the notation with 10^N is used.For example, to accept 6 digits number like 900000 on an axis call TGaxis::SetMaxDigits(6)
. The default value is 5. fgMaxDigits
must be greater than 0. Warning: this static function changes the max number of digits in all axes. If you only want to change the digits of the current TGaxis instance, use axis->SetNdivisions(N*1000000 + (axis->GetNdiv()%1000000)) instead of axis->SetMaxDigits(N).
Definition at line 2896 of file TGaxis.cxx.
Set the kMoreLogLabels bit flag.
When this option is selected more labels are drawn when in logarithmic scale and there is a small number of decades (less than 3). Note that this option is automatically inherited from TAxis
Definition at line 2914 of file TGaxis.cxx.
|
virtual |
Change the name of the axis.
Definition at line 2904 of file TGaxis.cxx.
|
inlinevirtual |
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).
Definition at line 2925 of file TGaxis.cxx.
void TGaxis::SetOption | ( | Option_t * | option = "" | ) |
To set axis options.
Definition at line 2934 of file TGaxis.cxx.
void TGaxis::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 nameb
abbreviated month named
day of the month (01-31)m
month (01-12)y
year without centuryfor time :
H
hour (24-hour clock)I
hour (12-hour clock)p
local equivalent of AM or PMM
minute (00-59)S
seconds (00-61)%%
% Definition at line 2969 of file TGaxis.cxx.
Change the time offset. If option = "gmt", set display mode to GMT.
Definition at line 2993 of file TGaxis.cxx.
|
virtual |
Change the title of the axis.
Definition at line 2942 of file TGaxis.cxx.
|
inline |
|
overridevirtual |
Stream an object of class TGaxis.
Reimplemented from TObject.
Definition at line 3043 of file TGaxis.cxx.
|
inline |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |