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
  • Marker style
  • Marker size

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);
@ kBlue
Definition: Rtypes.h:64

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
@ kOpenDoubleDiamond
Definition: TAttMarker.h:56
@ kStar
Definition: TAttMarker.h:46
@ kFullDotLarge
Definition: TAttMarker.h:47
@ kFullDoubleDiamond
Definition: TAttMarker.h:56
@ kOpenFourTrianglesX
Definition: TAttMarker.h:55
@ kOpenSquare
Definition: TAttMarker.h:49
@ kFullThreeTriangles
Definition: TAttMarker.h:54
@ kOpenTriangleUp
Definition: TAttMarker.h:50
@ kFourSquaresPlus
Definition: TAttMarker.h:59
@ kFullDotSmall
Definition: TAttMarker.h:47
@ kFullDotMedium
Definition: TAttMarker.h:47
@ kOpenTriangleDown
Definition: TAttMarker.h:51
@ kOpenThreeTriangles
Definition: TAttMarker.h:53
@ kFullCrossX
Definition: TAttMarker.h:58
@ kFullFourTrianglesX
Definition: TAttMarker.h:55
@ kFullTriangleDown
Definition: TAttMarker.h:49
@ kCircle
Definition: TAttMarker.h:46
@ kOpenCrossX
Definition: TAttMarker.h:58
@ kFullFourTrianglesPlus
Definition: TAttMarker.h:57
@ kFullSquare
Definition: TAttMarker.h:48
@ kOpenSquareDiagonal
Definition: TAttMarker.h:53
@ kFullStar
Definition: TAttMarker.h:51
@ kOpenDiamond
Definition: TAttMarker.h:50
@ kFullTriangleUp
Definition: TAttMarker.h:48
@ kOpenDiamondCross
Definition: TAttMarker.h:52
@ kOpenFourTrianglesPlus
Definition: TAttMarker.h:57
@ kMultiply
Definition: TAttMarker.h:46
@ kPlus
Definition: TAttMarker.h:46
@ kOctagonCross
Definition: TAttMarker.h:54
@ kFullCircle
Definition: TAttMarker.h:48
@ kDot
Definition: TAttMarker.h:46
@ kOpenCross
Definition: TAttMarker.h:50
@ kFourSquaresX
Definition: TAttMarker.h:58
@ kOpenCircle
Definition: TAttMarker.h:49
@ kFullCross
Definition: TAttMarker.h:52
@ kOpenStar
Definition: TAttMarker.h:51
@ kFullDiamond
Definition: TAttMarker.h:52
char name[80]
Definition: TGX11.cxx:109
Double_t x[n]
Definition: legend1.C:17
REAL ** triangle
Definition: triangle.c:478

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 Color_t GetMarkerColor () const
 Return the marker color. More...
 
virtual Size_t GetMarkerSize () const
 Return the marker size. More...
 
virtual Style_t GetMarkerStyle () const
 Return the marker style. 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 SetMarkerColor (Color_t mcolor=1)
 Set the marker color. More...
 
virtual void SetMarkerColorAlpha (Color_t mcolor, Float_t malpha)
 Set a transparent marker color. More...
 
virtual void SetMarkerSize (Size_t msize=1)
 Set the marker size. More...
 
virtual void SetMarkerStyle (Style_t mstyle=1)
 Set the marker 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:
[legend]

Constructor & Destructor Documentation

◆ TAttMarker() [1/2]

TAttMarker::TAttMarker ( )

TAttMarker default constructor.

Default text attributes are taking from the current style.

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

◆ ~TAttMarker()

TAttMarker::~TAttMarker ( )
virtual

TAttMarker destructor.

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

◆ GetMarkerColor()

virtual Color_t TAttMarker::GetMarkerColor ( ) const
inlinevirtual

Return the marker color.

Reimplemented in TGWin32VirtualXProxy.

Definition at line 31 of file TAttMarker.h.

◆ 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.

◆ Modify()

void TAttMarker::Modify ( )
virtual

Change current marker attributes if necessary.

Definition at line 220 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 235 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 245 of file TAttMarker.cxx.

◆ SetMarkerAttributes()

void TAttMarker::SetMarkerAttributes ( )
virtual

Invoke the DialogCanvas Marker attributes.

Reimplemented in TGWin32VirtualXProxy.

Definition at line 265 of file TAttMarker.cxx.

◆ SetMarkerColor()

◆ SetMarkerColorAlpha()

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

Set a transparent marker color.

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

Definition at line 274 of file TAttMarker.cxx.

◆ SetMarkerSize()

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

◆ SetMarkerStyle()

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

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.


The documentation for this class was generated from the following files: