Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches

Marker Attributes class.

This class is used (in general by secondary inheritance) by many other classes (graphics, histograms). It holds all the markers attributes.

Marker attributes

The marker attributes are:

Marker color

The marker color is a color index (integer) pointing in the ROOT color table. The marker color of any class inheriting from TAttMarker can be changed using the method SetMarkerColor and retrieved using the method GetMarkerColor. The following table shows the first 50 default colors.

Color transparency

SetMarkerColorAlpha(), allows to set a transparent color. In the following example the marker color of the histogram histo is set to blue with an opacity of 35% (i.e. a transparency of 65%). (The color kBlue itself is internally stored as fully opaque.)

histo->SetMarkerColorAlpha(kBlue, 0.35);
@ kBlue
Definition Rtypes.h:66

The transparency is available on all platforms when the flag OpenGL.CanvasPreferGL is set to 1 in $ROOTSYS/etc/system.rootrc, or on Mac with the Cocoa backend. On the file output it is visible with PDF, PNG, Gif, JPEG, SVG, TeX ... but not PostScript.

Alternatively, you can call at the top of your script gSytle->SetCanvasPreferGL();. Or if you prefer to activate GL for a single canvas c, then use c->SetSupportGL(true);.

Marker style

The Marker style defines the markers' shape. The marker style of any class inheriting from TAttMarker can be changed using the method SetMarkerStyle and retrieved using the method GetMarkerStyle.

The following list gives the currently supported markers (screen and PostScript) style. Each marker style is identified by an integer number (first column) corresponding to a marker shape (second column) and can be also accessed via a global name (third column).

Marker number Marker shape Marker name
1 dot kDot
2 + kPlus
3 * kStar
4 o kCircle
6 small dot kFullDotSmall
7 medium dot kFullDotMedium
8 large scalable dot kFullDotLarge
9 -->19 large scalable dot
20 full circle kFullCircle
21 full square kFullSquare
22 full triangle up kFullTriangleUp
23 full triangle down kFullTriangleDown
24 open circle kOpenCircle
25 open square kOpenSquare
26 open triangle up kOpenTriangleUp
27 open diamond kOpenDiamond
28 open cross kOpenCross
29 full star kFullStar
30 open star kOpenStar
31 *
32 open triangle down kOpenTriangleDown
33 full diamond kFullDiamond
34 full cross kFullCross
35 open diamond cross kOpenDiamondCross
36 open square diagonal kOpenSquareDiagonal
37 open three triangle kOpenThreeTriangles
38 octagon with cross kOctagonCross
39 full three triangles kFullThreeTriangles
40 open four triangleX kOpenFourTrianglesX
41 full four triangleX kFullFourTrianglesX
42 open double diamond kOpenDoubleDiamond
43 full double diamond kFullDoubleDiamond
44 open four triangle+ kOpenFourTrianglesPlus
45 full four triangle+ kFullFourTrianglesPlus
46 open cross X kOpenCrossX
47 full cross X kFullCrossX
48 four squares X kFourSquaresX
49 four squares+ kFourSquaresPlus
@ kOpenDoubleDiamond
Definition TAttMarker.h:63
@ kStar
Definition TAttMarker.h:53
@ kFullDotLarge
Definition TAttMarker.h:54
@ kFullDoubleDiamond
Definition TAttMarker.h:63
@ kOpenFourTrianglesX
Definition TAttMarker.h:62
@ kOpenSquare
Definition TAttMarker.h:56
@ kFullThreeTriangles
Definition TAttMarker.h:61
@ kOpenTriangleUp
Definition TAttMarker.h:57
@ kFourSquaresPlus
Definition TAttMarker.h:66
@ kFullDotSmall
Definition TAttMarker.h:54
@ kFullDotMedium
Definition TAttMarker.h:54
@ kOpenTriangleDown
Definition TAttMarker.h:58
@ kOpenThreeTriangles
Definition TAttMarker.h:60
@ kFullCrossX
Definition TAttMarker.h:65
@ kFullFourTrianglesX
Definition TAttMarker.h:62
@ kFullTriangleDown
Definition TAttMarker.h:56
@ kCircle
Definition TAttMarker.h:53
@ kOpenCrossX
Definition TAttMarker.h:65
@ kFullFourTrianglesPlus
Definition TAttMarker.h:64
@ kFullSquare
Definition TAttMarker.h:55
@ kOpenSquareDiagonal
Definition TAttMarker.h:60
@ kFullStar
Definition TAttMarker.h:58
@ kOpenDiamond
Definition TAttMarker.h:57
@ kFullTriangleUp
Definition TAttMarker.h:55
@ kOpenDiamondCross
Definition TAttMarker.h:59
@ kOpenFourTrianglesPlus
Definition TAttMarker.h:64
@ kMultiply
Definition TAttMarker.h:53
@ kPlus
Definition TAttMarker.h:53
@ kOctagonCross
Definition TAttMarker.h:61
@ kFullCircle
Definition TAttMarker.h:55
@ kDot
Definition TAttMarker.h:53
@ kOpenCross
Definition TAttMarker.h:57
@ kFourSquaresX
Definition TAttMarker.h:65
@ kOpenCircle
Definition TAttMarker.h:56
@ kFullCross
Definition TAttMarker.h:59
@ kOpenStar
Definition TAttMarker.h:58
@ kFullDiamond
Definition TAttMarker.h:59
#define X(type, name)
char name[80]
Definition TGX11.cxx:110
Double_t x[n]
Definition legend1.C:17
Warning
Non-symmetric symbols should be used carefully. See markerwarning.C

Marker line width

The line width of a marker is not actually a marker attribute since it does only apply to open marker symbols and marker symbols consisting of lines. All of these marker symbols are redefined with thicker lines by style numbers starting from 50:

Marker numbers Line width
50 - 67 2
68 - 85 3
86 - 103 4
104 - 121 5
...
Option_t Option_t width

Marker size

Various marker sizes are shown in the figure below. The default marker size=1 is shown in the top left corner. Marker sizes smaller than 1 can be specified. The marker size does not refer to any coordinate systems, it is an absolute value. Therefore the marker size is not affected by any change in TPad's scale. A marker size equal to 1 correspond to 8 pixels. That is, a square marker with size 1 will be drawn with a side equal to 8 pixels on the screen.

The marker size of any class inheriting from TAttMarker can be changed using the method SetMarkerSize and retrieved using the method GetMarkerSize.

Note that the marker styles number 1 6 and 7 (the dots), cannot be scaled. They are meant to be very fast to draw and are always drawn with the same number of pixels; therefore SetMarkerSize does not apply on them. To have a "scalable dot" a filled circle should be used instead, i.e. the marker style number 20. By default (if SetMarkerStyle is not specified), the marker style used is 1. That's the most common one to draw scatter plots.

Definition at line 19 of file TAttMarker.h.

Public Member Functions

 TAttMarker ()
 TAttMarker default constructor.
 
 TAttMarker (Color_t color, Style_t style, Size_t msize)
 TAttMarker normal constructor.
 
virtual ~TAttMarker ()
 TAttMarker destructor.
 
void Copy (TAttMarker &attmarker) const
 Copy this marker attributes to a new TAttMarker.
 
virtual Color_t GetMarkerColor () const
 Return the marker color.
 
virtual Size_t GetMarkerSize () const
 Return the marker size.
 
virtual Style_t GetMarkerStyle () const
 Return the marker style.
 
virtual TClassIsA () const
 
virtual void Modify ()
 Change current marker attributes if necessary.
 
virtual void ResetAttMarker (Option_t *toption="")
 Reset this marker attributes to the default values.
 
virtual void SaveMarkerAttributes (std::ostream &out, const char *name, Int_t coldef=1, Int_t stydef=1, Int_t sizdef=1)
 Save line attributes as C++ statement(s) on output stream out.
 
virtual void SetMarkerAttributes ()
 Invoke the DialogCanvas Marker attributes.
 
virtual void SetMarkerColor (Color_t mcolor=1)
 Set the marker color.
 
virtual void SetMarkerColorAlpha (Color_t mcolor, Float_t malpha)
 Set a transparent marker color.
 
virtual void SetMarkerSize (Size_t msize=1)
 Set the marker size.
 
virtual void SetMarkerStyle (Style_t mstyle=1)
 Set the marker style.
 
virtual void Streamer (TBuffer &)
 
void StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b)
 

Static Public Member Functions

static TClassClass ()
 
static const char * Class_Name ()
 
static constexpr Version_t Class_Version ()
 
static const char * DeclFileName ()
 
static Width_t GetMarkerLineWidth (Style_t style)
 Internal helper function that returns the line width of the given marker style (0 = filled marker)
 
static Style_t GetMarkerStyleBase (Style_t style)
 Internal helper function that returns the corresponding marker style with line width 1 for the given style.
 

Protected Attributes

Color_t fMarkerColor
 Marker color.
 
Size_t fMarkerSize
 Marker size.
 
Style_t fMarkerStyle
 Marker style.
 

#include <TAttMarker.h>

Inheritance diagram for TAttMarker:
[legend]

Constructor & Destructor Documentation

◆ TAttMarker() [1/2]

TAttMarker::TAttMarker ( )

TAttMarker default constructor.

Default text attributes are taking from the current style.

Definition at line 211 of file TAttMarker.cxx.

◆ TAttMarker() [2/2]

TAttMarker::TAttMarker ( Color_t  color,
Style_t  style,
Size_t  msize 
)

TAttMarker normal constructor.

Text attributes are taking from the argument list

  • color : Marker Color Index
  • style : Marker style (from 1 to 30)
  • size : marker size (float)

Definition at line 227 of file TAttMarker.cxx.

◆ ~TAttMarker()

TAttMarker::~TAttMarker ( )
virtual

TAttMarker destructor.

Definition at line 237 of file TAttMarker.cxx.

Member Function Documentation

◆ Class()

static TClass * TAttMarker::Class ( )
static
Returns
TClass describing this class

◆ Class_Name()

static const char * TAttMarker::Class_Name ( )
static
Returns
Name of this class

◆ Class_Version()

static constexpr Version_t TAttMarker::Class_Version ( )
inlinestaticconstexpr
Returns
Version of this class

Definition at line 50 of file TAttMarker.h.

◆ Copy()

void TAttMarker::Copy ( TAttMarker attmarker) const

Copy this marker attributes to a new TAttMarker.

Definition at line 244 of file TAttMarker.cxx.

◆ DeclFileName()

static const char * TAttMarker::DeclFileName ( )
inlinestatic
Returns
Name of the file containing the class declaration

Definition at line 50 of file TAttMarker.h.

◆ GetMarkerColor()

virtual Color_t TAttMarker::GetMarkerColor ( ) const
inlinevirtual

Return the marker color.

Reimplemented in TGWin32VirtualXProxy.

Definition at line 31 of file TAttMarker.h.

◆ GetMarkerLineWidth()

Width_t TAttMarker::GetMarkerLineWidth ( Style_t  style)
static

Internal helper function that returns the line width of the given marker style (0 = filled marker)

Definition at line 306 of file TAttMarker.cxx.

◆ GetMarkerSize()

virtual Size_t TAttMarker::GetMarkerSize ( ) const
inlinevirtual

Return the marker size.

Reimplemented in TGWin32VirtualXProxy.

Definition at line 33 of file TAttMarker.h.

◆ GetMarkerStyle()

virtual Style_t TAttMarker::GetMarkerStyle ( ) const
inlinevirtual

Return the marker style.

Reimplemented in TGWin32VirtualXProxy.

Definition at line 32 of file TAttMarker.h.

◆ GetMarkerStyleBase()

Style_t TAttMarker::GetMarkerStyleBase ( Style_t  style)
static

Internal helper function that returns the corresponding marker style with line width 1 for the given style.

Definition at line 255 of file TAttMarker.cxx.

◆ IsA()

◆ Modify()

void TAttMarker::Modify ( )
virtual

Change current marker attributes if necessary.

Definition at line 323 of file TAttMarker.cxx.

◆ ResetAttMarker()

void TAttMarker::ResetAttMarker ( Option_t toption = "")
virtual

Reset this marker attributes to the default values.

Reimplemented in TGWin32VirtualXProxy.

Definition at line 338 of file TAttMarker.cxx.

◆ SaveMarkerAttributes()

void TAttMarker::SaveMarkerAttributes ( std::ostream &  out,
const char *  name,
Int_t  coldef = 1,
Int_t  stydef = 1,
Int_t  sizdef = 1 
)
virtual

Save line attributes as C++ statement(s) on output stream out.

Definition at line 348 of file TAttMarker.cxx.

◆ SetMarkerAttributes()

void TAttMarker::SetMarkerAttributes ( )
virtual

Invoke the DialogCanvas Marker attributes.

Reimplemented in TGWin32VirtualXProxy.

Definition at line 367 of file TAttMarker.cxx.

◆ SetMarkerColor()

◆ SetMarkerColorAlpha()

void TAttMarker::SetMarkerColorAlpha ( Color_t  mcolor,
Float_t  malpha 
)
virtual

Set a transparent marker color.

Parameters
mcolordefines the marker color
malphadefines the percentage of opacity from 0. (fully transparent) to 1. (fully opaque).
Note
malpha is ignored (treated as 1) if the TCanvas has no GL support activated.

Definition at line 378 of file TAttMarker.cxx.

◆ SetMarkerSize()

virtual void TAttMarker::SetMarkerSize ( Size_t  msize = 1)
inlinevirtual

Set the marker size.

Note that the marker styles number 1 6 and 7 (the dots), cannot be scaled. They are meant to be very fast to draw and are always drawn with the same number of pixels; therefore this method does not apply on them.

Reimplemented in TVirtualX, TGQuartz, TGWin32, TGWin32VirtualXProxy, TGX11, TTeXDump, TEvePointSet, TEvePointSetArray, ROOT::Experimental::REvePointSet, ROOT::Experimental::REvePointSetArray, TEveTrackList, and ROOT::Experimental::REveTrackList.

Definition at line 45 of file TAttMarker.h.

◆ SetMarkerStyle()

virtual void TAttMarker::SetMarkerStyle ( Style_t  mstyle = 1)
inlinevirtual

◆ Streamer()

◆ StreamerNVirtual()

void TAttMarker::StreamerNVirtual ( TBuffer ClassDef_StreamerNVirtual_b)
inline

Definition at line 50 of file TAttMarker.h.

Member Data Documentation

◆ fMarkerColor

Color_t TAttMarker::fMarkerColor
protected

Marker color.

Definition at line 22 of file TAttMarker.h.

◆ fMarkerSize

Size_t TAttMarker::fMarkerSize
protected

Marker size.

Definition at line 24 of file TAttMarker.h.

◆ fMarkerStyle

Style_t TAttMarker::fMarkerStyle
protected

Marker style.

Definition at line 23 of file TAttMarker.h.

  • core/base/inc/TAttMarker.h
  • core/base/src/TAttMarker.cxx