Logo ROOT  
Reference Guide

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 a transparency of 35%. The color kBlue itself remains fully opaque.

histo->SetMarkerColorAlpha(kBlue, 0.35);

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.

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
24 open circle kOpenCircle
25 open square kOpenSquare
27 open diamond kOpenDiamond
28 open cross kOpenCross
29 full star kFullStar
30 open star kOpenStar
31 *
33 full diamond kFullDiamond
34 full cross kFullCross
35 open diamond cross kOpenDiamondCross
36 open square diagonal kOpenSquareDiagonal
38 octagon with cross kOctagonCross
39 full three trangles kFullThreeTriangles
40 open four triangleX kOpenFourTrianglesX
41 full four triangleX kFullFourTrianglesX
42 open double diamond kOpenDoubleDiamond
43 full double diamond kFullDoubleDiamond
46 open cross X kOpenCrossX
47 full cross X kFullCrossX
48 four squares X kFourSquaresX
49 four squares+ kFourSquaresPlus

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

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. More...
 TAttMarker (Color_t color, Style_t style, Size_t msize)
 TAttMarker normal constructor. More...
virtual ~TAttMarker ()
 TAttMarker destructor. More...
void Copy (TAttMarker &attmarker) const
 Copy this marker attributes to a new TAttMarker. More...
virtual void Modify ()
 Change current marker attributes if necessary. More...
virtual void ResetAttMarker (Option_t *toption="")
 Reset this marker attributes to the default values. More...
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. More...
virtual void SetMarkerAttributes ()
 Invoke the DialogCanvas Marker attributes. More...
virtual void SetMarkerColorAlpha (Color_t mcolor, Float_t malpha)
 Set a transparent marker color. More...

Static Public Member Functions

static Width_t GetMarkerLineWidth (Style_t style)
 Internal helper function that returns the line width of the given marker style (0 = filled marker) More...
static Style_t GetMarkerStyleBase (Style_t style)
 Internal helper function that returns the corresponding marker style with line width 1 for the given style. More...

Protected Attributes

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

#include <TAttMarker.h>

Inheritance diagram for TAttMarker:

Constructor & Destructor Documentation

◆ TAttMarker() [1/2]

TAttMarker::TAttMarker ( )

TAttMarker default constructor.

Default text attributes are taking from the current style.

Definition at line 202 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 218 of file TAttMarker.cxx.

◆ ~TAttMarker()

TAttMarker::~TAttMarker ( )

TAttMarker destructor.

Definition at line 228 of file TAttMarker.cxx.

Member Function Documentation

◆ Copy()

void TAttMarker::Copy ( TAttMarker attmarker) const

Copy this marker attributes to a new TAttMarker.

Definition at line 235 of file TAttMarker.cxx.

◆ GetMarkerLineWidth()

Width_t TAttMarker::GetMarkerLineWidth ( Style_t  style)

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

Definition at line 297 of file TAttMarker.cxx.

◆ GetMarkerStyleBase()

Style_t TAttMarker::GetMarkerStyleBase ( Style_t  style)

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

Definition at line 246 of file TAttMarker.cxx.

◆ Modify()

void TAttMarker::Modify ( )

Change current marker attributes if necessary.

Definition at line 314 of file TAttMarker.cxx.

◆ ResetAttMarker()

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

Reset this marker attributes to the default values.

Reimplemented in TGWin32VirtualXProxy.

Definition at line 329 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 

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

Definition at line 339 of file TAttMarker.cxx.

◆ SetMarkerAttributes()

void TAttMarker::SetMarkerAttributes ( )

Invoke the DialogCanvas Marker attributes.

Reimplemented in TGWin32VirtualXProxy.

Definition at line 359 of file TAttMarker.cxx.

◆ SetMarkerColorAlpha()

void TAttMarker::SetMarkerColorAlpha ( Color_t  mcolor,
Float_t  malpha 

Set a transparent marker color.

malpha defines the percentage of the color opacity from 0. (fully transparent) to 1. (fully opaque).

Definition at line 368 of file TAttMarker.cxx.

Member Data Documentation

◆ fMarkerColor

Color_t TAttMarker::fMarkerColor

Marker color.

Definition at line 28 of file TAttMarker.h.

◆ fMarkerSize

Size_t TAttMarker::fMarkerSize

Marker size.

Definition at line 30 of file TAttMarker.h.

◆ fMarkerStyle

Style_t TAttMarker::fMarkerStyle

Marker style.

Definition at line 29 of file TAttMarker.h.

The documentation for this class was generated from the following files:
@ kFullStar
Definition: TAttMarker.h:54
@ kOpenCircle
Definition: TAttMarker.h:52
@ kFullFourTrianglesX
Definition: TAttMarker.h:58
@ kFullCross
Definition: TAttMarker.h:55
@ kOpenCrossX
Definition: TAttMarker.h:61
@ kOpenStar
Definition: TAttMarker.h:54
@ kFullFourTrianglesPlus
Definition: TAttMarker.h:60
include TDocParser_001 C image html pict1_TDocParser_001 png width
Definition: TDocParser.cxx:121
REAL ** triangle
Definition: triangle.c:478
Double_t x[n]
Definition: legend1.C:17
@ kPlus
Definition: TAttMarker.h:49
@ open
Definition: GenVectorIO.h:55
@ kOpenTriangleDown
Definition: TAttMarker.h:54
@ kFullDoubleDiamond
Definition: TAttMarker.h:59
@ kOpenDiamondCross
Definition: TAttMarker.h:55
@ kOpenFourTrianglesX
Definition: TAttMarker.h:58
@ kOpenFourTrianglesPlus
Definition: TAttMarker.h:60
@ kFullCircle
Definition: TAttMarker.h:51
@ kFullTriangleUp
Definition: TAttMarker.h:51
@ kCircle
Definition: TAttMarker.h:49
@ kDot
Definition: TAttMarker.h:49
@ kOctagonCross
Definition: TAttMarker.h:57
@ kFullDotSmall
Definition: TAttMarker.h:50
@ kOpenThreeTriangles
Definition: TAttMarker.h:56
@ kStar
Definition: TAttMarker.h:49
@ kOpenCross
Definition: TAttMarker.h:53
@ kFullSquare
Definition: TAttMarker.h:51
@ kFullCrossX
Definition: TAttMarker.h:61
@ kOpenDoubleDiamond
Definition: TAttMarker.h:59
@ kFullDotLarge
Definition: TAttMarker.h:50
@ kOpenDiamond
Definition: TAttMarker.h:53
char name[80]
Definition: TGX11.cxx:110
@ kOpenSquare
Definition: TAttMarker.h:52
@ kBlue
Definition: Rtypes.h:66
@ kFourSquaresPlus
Definition: TAttMarker.h:62
@ kOpenSquareDiagonal
Definition: TAttMarker.h:56
@ kFourSquaresX
Definition: TAttMarker.h:61
@ kOpenTriangleUp
Definition: TAttMarker.h:53
@ kFullTriangleDown
Definition: TAttMarker.h:52
@ kFullThreeTriangles
Definition: TAttMarker.h:57
@ kMultiply
Definition: TAttMarker.h:49
@ kFullDiamond
Definition: TAttMarker.h:55
@ kFullDotMedium
Definition: TAttMarker.h:50