ROOT logo
ROOT » CORE » BASE » TAttMarker

class TAttMarker


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.
output of MACRO_TAttMarker_1_c
{
   TCanvas *c = new TCanvas("c","Marker colors",0,0,500,200);
   c.DrawColorTable();
   return c;
}

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
        5                    x                    kMultiply
        6                    small scalable dot   kFullDotSmall
        7                    medium scalable dot  kFullDotMedium
        8                    large scalable dot   kFullDotLarge
        9 -->19              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                    open star            kOpenStar
       30                    full star            kFullStar
output of MACRO_TAttMarker_3_c
{
   TCanvas *c = new TCanvas("c","Marker types",0,0,500,200);
   TMarker marker;
   marker.DisplayMarkerTypes();
   return c;
}

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. The marker size of any class inheriting from TAttMarker can be changed using the method SetMarkerSize and retrieved using the method GetMarkerSize.
output of MACRO_TAttMarker_5_c
{
   c = new TCanvas("c","Marker sizes",0,0,500,200);
   TMarker marker;
   marker.SetMarkerStyle(3);
   Double_t x = 0;
   Double_t dx = 1/6.0;
   for (Int_t i=1; i<6; i++) {
      x += dx;
      marker.SetMarkerSize(i*0.2); marker.DrawMarker(x,.165);
      marker.SetMarkerSize(i*0.8); marker.DrawMarker(x,.495);
      marker.SetMarkerSize(i*1.0); marker.DrawMarker(x,.835);
   }
   return c;
}

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.
 

Function Members (Methods)

public:
TAttMarker()
TAttMarker(const TAttMarker&)
TAttMarker(Color_t color, Style_t style, Size_t msize)
virtual~TAttMarker()
static TClass*Class()
voidCopy(TAttMarker& attmarker) const
virtual Color_tGetMarkerColor() const
virtual Size_tGetMarkerSize() const
virtual Style_tGetMarkerStyle() const
virtual TClass*IsA() const
virtual voidModify()
TAttMarker&operator=(const TAttMarker&)
virtual voidResetAttMarker(Option_t* toption = "")
virtual voidSaveMarkerAttributes(ostream& out, const char* name, Int_t coldef = 1, Int_t stydef = 1, Int_t sizdef = 1)
virtual voidSetMarkerAttributes()MENU
virtual voidSetMarkerColor(Color_t tcolor = 1)
virtual voidSetMarkerSize(Size_t msize = 1)
virtual voidSetMarkerStyle(Style_t mstyle = 1)
virtual voidShowMembers(TMemberInspector& insp, char* parent)
virtual voidStreamer(TBuffer& b)
voidStreamerNVirtual(TBuffer& b)

Data Members

protected:
Color_tfMarkerColorMarker color index
Size_tfMarkerSizeMarker size
Style_tfMarkerStyleMarker style

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

TAttMarker()
 TAttMarker default constructor.

 Default text attributes are taking from the current style.
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)
~TAttMarker()
 TAttMarker destructor.
void Copy(TAttMarker& attmarker) const
 Copy this marker attributes to a new TAttMarker.
void Modify()
 Change current marker attributes if necessary.
void ResetAttMarker(Option_t* toption = "")
 Reset this marker attributes to the default values.
void SaveMarkerAttributes(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.
void SetMarkerAttributes()
 Invoke the DialogCanvas Marker attributes.
TAttMarker()
Color_t GetMarkerColor() const
{return fMarkerColor;}
Style_t GetMarkerStyle() const
{return fMarkerStyle;}
Size_t GetMarkerSize() const
{return fMarkerSize;}
void SetMarkerColor(Color_t tcolor = 1)
{ fMarkerColor = tcolor;}
void SetMarkerStyle(Style_t mstyle = 1)
{ fMarkerStyle = mstyle;}
void SetMarkerSize(Size_t msize = 1)
{ fMarkerSize = msize;}