ROOT logo
ROOT » HIST » HISTPAINTER » TPaletteAxis

class TPaletteAxis: public TPave


The palette painting class

A TPaletteAxis object is used to display the color palette when drawing 2-d histograms.

The TPaletteAxis is automatically created drawn when drawing a 2-D histogram when the option "Z" is specified.

A TPaletteAxis object is added to the histogram list of functions and can be retrieved doing:

   TPaletteAxis *palette = (TPaletteAxis*)h->GetListOfFunctions()->FindObject("palette");
then the pointer palette can be used to change the pallette attributes.

Because the palette is created at painting time only, one must issue a:

   gPad->Update();
before retrieving the palette pointer in order to create the palette. The following macro gives an example.
output of MACRO_TPaletteAxis_1_c1
{
   TCanvas *c1 = new TCanvas("c1","c1",600,400);
   TH2F *h2 = new TH2F("h2","Example of a resized palette ",40,-4,4,40,-20,20);
   Float_t px, py;
   for (Int_t i = 0; i < 25000; i++) {
      gRandom->Rannor(px,py);
      h2->Fill(px,5*py);
   }
   gStyle->SetPalette(1);
   h2->Draw("COLZ");
   gPad->Update();
   TPaletteAxis *palette = (TPaletteAxis*)h2->GetListOfFunctions()->FindObject("palette");
   palette->SetY2NDC(0.7);
   return c1;
}
TPaletteAxis inherits from TBox and TPave. The methods
allowing to specify the palette position are inherited from these two classes.

The palette can be interactively moved and resized. The context menu can be used to set the axis attributes.

It is possible to select a range on the axis to set the min/max in z

 

Function Members (Methods)

public:
TPaletteAxis()
TPaletteAxis(const TPaletteAxis& palette)
TPaletteAxis(Double_t x1, Double_t y1, Double_t x2, Double_t y2, TH1* h)
virtual~TPaletteAxis()
voidTObject::AbstractMethod(const char* method) const
virtual voidTObject::AppendPad(Option_t* option = "")
virtual voidTObject::Browse(TBrowser* b)
static TClass*Class()
virtual const char*TObject::ClassName() const
virtual voidTObject::Clear(Option_t* = "")
virtual TObject*TObject::Clone(const char* newname = "") const
virtual Int_tTObject::Compare(const TObject* obj) const
virtual voidTPave::ConvertNDCtoPad()
virtual voidCopy(TObject& palette) const
virtual voidTObject::Delete(Option_t* option = "")MENU
Int_tTAttLine::DistancetoLine(Int_t px, Int_t py, Double_t xp1, Double_t yp1, Double_t xp2, Double_t yp2)
virtual Int_tDistancetoPrimitive(Int_t px, Int_t py)
virtual voidTPave::Draw(Option_t* option = "")
virtual TBox*TBox::DrawBox(Double_t x1, Double_t y1, Double_t x2, Double_t y2)
virtual voidTObject::DrawClass() constMENU
virtual TObject*TObject::DrawClone(Option_t* option = "") constMENU
virtual voidTPave::DrawPave(Double_t x1, Double_t y1, Double_t x2, Double_t y2, Int_t bordersize = 4, Option_t* option = "br")
virtual voidTObject::Dump() constMENU
virtual voidTObject::Error(const char* method, const char* msgfmt) const
virtual voidTObject::Execute(const char* method, const char* params, Int_t* error = 0)
virtual voidTObject::Execute(TMethod* method, TObjArray* params, Int_t* error = 0)
virtual voidExecuteEvent(Int_t event, Int_t px, Int_t py)
virtual voidTObject::Fatal(const char* method, const char* msgfmt) const
virtual TObject*TObject::FindObject(const char* name) const
virtual TObject*TObject::FindObject(const TObject* obj) const
TGaxis*GetAxis()
Int_tGetBinColor(Int_t i, Int_t j)
Int_tTPave::GetBorderSize() const
Double_tTPave::GetCornerRadius() const
virtual Option_t*TObject::GetDrawOption() const
static Long_tTObject::GetDtorOnly()
virtual Color_tTAttFill::GetFillColor() const
virtual Style_tTAttFill::GetFillStyle() const
virtual const char*TObject::GetIconName() const
virtual Color_tTAttLine::GetLineColor() const
virtual Style_tTAttLine::GetLineStyle() const
virtual Width_tTAttLine::GetLineWidth() const
virtual Option_t*GetName() const
virtual char*GetObjectInfo(Int_t px, Int_t py) const
static Bool_tTObject::GetObjectStat()
virtual Option_t*TPave::GetOption() const
Int_tTPave::GetShadowColor() const
virtual const char*TObject::GetTitle() const
virtual UInt_tTObject::GetUniqueID() const
Int_tGetValueColor(Double_t zc)
Double_tTBox::GetX1() const
Double_tTPave::GetX1NDC() const
Double_tTBox::GetX2() const
Double_tTPave::GetX2NDC() const
Double_tTBox::GetY1() const
Double_tTPave::GetY1NDC() const
Double_tTBox::GetY2() const
Double_tTPave::GetY2NDC() const
virtual Bool_tTObject::HandleTimer(TTimer* timer)
virtual ULong_tTPave::Hash() const
virtual voidTBox::HideToolTip(Int_t event)
virtual voidTObject::Info(const char* method, const char* msgfmt) const
virtual Bool_tTObject::InheritsFrom(const char* classname) const
virtual Bool_tTObject::InheritsFrom(const TClass* cl) const
virtual voidTObject::Inspect() constMENU
voidTObject::InvertBit(UInt_t f)
virtual TClass*IsA() const
Bool_tTBox::IsBeingResized() const
virtual Bool_tTObject::IsEqual(const TObject* obj) const
virtual Bool_tTObject::IsFolder() const
virtual Int_tTBox::IsInside(Double_t x, Double_t y) const
Bool_tTObject::IsOnHeap() const
virtual Bool_tTPave::IsSortable() const
virtual Bool_tTAttFill::IsTransparent() const
Bool_tTObject::IsZombie() const
virtual voidTPave::ls(Option_t* option = "") const
voidTObject::MayNotUse(const char* method) const
virtual voidTAttLine::Modify()
virtual Bool_tTObject::Notify()
voidTObject::Obsolete(const char* method, const char* asOfVers, const char* removedFromVers) const
static voidTObject::operator delete(void* ptr)
static voidTObject::operator delete(void* ptr, void* vp)
static voidTObject::operator delete[](void* ptr)
static voidTObject::operator delete[](void* ptr, void* vp)
void*TObject::operator new(size_t sz)
void*TObject::operator new(size_t sz, void* vp)
void*TObject::operator new[](size_t sz)
void*TObject::operator new[](size_t sz, void* vp)
TPave&TPave::operator=(const TPave&)
virtual voidPaint(Option_t* option = "")
virtual voidTBox::PaintBox(Double_t x1, Double_t y1, Double_t x2, Double_t y2, Option_t* option = "")
virtual voidTPave::PaintPave(Double_t x1, Double_t y1, Double_t x2, Double_t y2, Int_t bordersize = 4, Option_t* option = "br")
virtual voidTPave::PaintPaveArc(Double_t x1, Double_t y1, Double_t x2, Double_t y2, Int_t bordersize = 4, Option_t* option = "br")
virtual voidTObject::Pop()
virtual voidTPave::Print(Option_t* option = "") const
virtual Int_tTObject::Read(const char* name)
virtual voidTObject::RecursiveRemove(TObject* obj)
virtual voidTAttFill::ResetAttFill(Option_t* option = "")
virtual voidTAttLine::ResetAttLine(Option_t* option = "")
voidTObject::ResetBit(UInt_t f)
virtual voidTObject::SaveAs(const char* filename = "", Option_t* option = "") constMENU
virtual voidTAttFill::SaveFillAttributes(ostream& out, const char* name, Int_t coldef = 1, Int_t stydef = 1001)
virtual voidTAttLine::SaveLineAttributes(ostream& out, const char* name, Int_t coldef = 1, Int_t stydef = 1, Int_t widdef = 1)
virtual voidSavePrimitive(ostream& out, Option_t* option = "")
voidTObject::SetBit(UInt_t f)
voidTObject::SetBit(UInt_t f, Bool_t set)
virtual voidTPave::SetBorderSize(Int_t bordersize = 4)MENU
virtual voidTPave::SetCornerRadius(Double_t rad = 0.2)MENU
virtual voidTObject::SetDrawOption(Option_t* option = "")MENU
static voidTObject::SetDtorOnly(void* obj)
virtual voidTAttFill::SetFillAttributes()MENU
virtual voidTAttFill::SetFillColor(Color_t fcolor)
virtual voidTAttFill::SetFillStyle(Style_t fstyle)
virtual voidSetLabelColor(Int_t labelcolor)MENU
virtual voidSetLabelFont(Int_t labelfont)MENU
virtual voidSetLabelOffset(Float_t labeloffset)MENU
virtual voidSetLabelSize(Float_t labelsize)MENU
virtual voidTAttLine::SetLineAttributes()MENU
virtual voidSetLineColor(Color_t linecolor)MENU
virtual voidTAttLine::SetLineStyle(Style_t lstyle)
virtual voidSetLineWidth(Width_t linewidth)MENU
virtual voidSetName(const char* name = "")MENU
static voidTObject::SetObjectStat(Bool_t stat)
virtual voidTPave::SetOption(Option_t* option = "br")
virtual voidTPave::SetShadowColor(Int_t color)MENU
virtual voidSetTitleOffset(Float_t titleoffset = 1)MENU
virtual voidSetTitleSize(Float_t titlesize)MENU
virtual voidTBox::SetToolTipText(const char* text, Long_t delayms = 1000)
virtual voidTObject::SetUniqueID(UInt_t uid)
virtual voidTBox::SetX1(Double_t x1)
virtual voidTPave::SetX1NDC(Double_t x1)
virtual voidTBox::SetX2(Double_t x2)
virtual voidTPave::SetX2NDC(Double_t x2)
virtual voidTBox::SetY1(Double_t y1)
virtual voidTPave::SetY1NDC(Double_t y1)
virtual voidTBox::SetY2(Double_t y2)
virtual voidTPave::SetY2NDC(Double_t y2)
virtual voidShowMembers(TMemberInspector& insp)
virtual voidStreamer(TBuffer& b)
voidStreamerNVirtual(TBuffer& b)
virtual voidTObject::SysError(const char* method, const char* msgfmt) const
Bool_tTObject::TestBit(UInt_t f) const
Int_tTObject::TestBits(UInt_t f) const
virtual voidUnZoom()MENU
virtual voidTObject::UseCurrentStyle()
virtual voidTObject::Warning(const char* method, const char* msgfmt) const
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0)
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) const
protected:
virtual voidTObject::DoError(int level, const char* location, const char* fmt, va_list va) const
voidTObject::MakeZombie()

Data Members

public:
enum { kHasView
};
enum TPave::[unnamed] { kNameIsAction
};
enum TBox::[unnamed] { kCannotMove
};
enum TObject::EStatusBits { kCanDelete
kMustCleanup
kObjInCanvas
kIsReferenced
kHasUUID
kCannotPick
kNoContextMenu
kInvalidObject
};
enum TObject::[unnamed] { kIsOnHeap
kNotDeleted
kZombie
kBitMask
kSingleKey
kOverwrite
kWriteDelete
};
protected:
TGaxisfAxispalette axis
Int_tTPave::fBorderSizewindow box bordersize in pixels
Double_tTPave::fCornerRadiusCorner radius in case of option arc
Color_tTAttFill::fFillColorfill area color
Style_tTAttFill::fFillStylefill area style
TH1*fHpointer to parent histogram
Int_tTPave::fInit(=0 if transformation to NDC not yet done)
Color_tTAttLine::fLineColorline color
Style_tTAttLine::fLineStyleline style
Width_tTAttLine::fLineWidthline width
TStringfNamePave name
TStringTPave::fNamePave name
TStringTPave::fOptionPave style
Bool_tTBox::fResizing!True if box is being resized
Int_tTPave::fShadowColorColor of the pave's shadow
Double_tTBox::fX1X of 1st point
Double_tTPave::fX1NDCX1 point in NDC coordinates
Double_tTBox::fX2X of 2nd point
Double_tTPave::fX2NDCX2 point in NDC coordinates
Double_tTBox::fY1Y of 1st point
Double_tTPave::fY1NDCY1 point in NDC coordinates
Double_tTBox::fY2Y of 2nd point
Double_tTPave::fY2NDCY2 point in NDC coordinates

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

TPaletteAxis()
 Palette default constructor.
TPaletteAxis(Double_t x1, Double_t y1, Double_t x2, Double_t y2, TH1* h)
 Palette normal constructor.
~TPaletteAxis()
 Palette destructor.
TPaletteAxis(const TPaletteAxis& palette)
 Palette copy constructor.
void Copy(TObject& palette) const
 Copy a palette to a palette.
Int_t DistancetoPrimitive(Int_t px, Int_t py)
 Check if mouse on the axis region.
void ExecuteEvent(Int_t event, Int_t px, Int_t py)
 Check if mouse on the axis region.
Int_t GetBinColor(Int_t i, Int_t j)
 Returns the color index of the bin (i,j).

 This function should be used after an histogram has been plotted with the
 option COL or COLZ like in the following example:

   h2->Draw("COLZ");
   gPad->Update();
   TPaletteAxis *palette =
      (TPaletteAxis*)h2->GetListOfFunctions()->FindObject("palette");
   Int_t ci = palette->GetBinColor(20,15);

 Then it is possible to retrieve the RGB components in the following way:

   TColor *c = gROOT->GetColor(ci);
   float x,y,z;
   c->GetRGB(x,y,z);
char * GetObjectInfo(Int_t px, Int_t py) const
 Displays the z value corresponding to cursor position py.
Int_t GetValueColor(Double_t zc)
 Returns the color index of the given z value

 This function should be used after an histogram has been plotted with the
 option COL or COLZ like in the following example:

   h2->Draw("COLZ");
   gPad->Update();
   TPaletteAxis *palette =
      (TPaletteAxis*)h2->GetListOfFunctions()->FindObject("palette");
   Int_t ci = palette->GetValueColor(30.);

 Then it is possible to retrieve the RGB components in the following way:

   TColor *c = gROOT->GetColor(ci);
   float x,y,z;
   c->GetRGB(x,y,z);
void Paint(Option_t* option = "")
 Paint the palette.
void SavePrimitive(ostream& out, Option_t* option = "")
 Save primitive as a C++ statement(s) on output stream out.
void UnZoom()
 Unzoom the palette
TGaxis * GetAxis()
{return &fAxis;}
Option_t * GetName() const
{return fName.Data();}
void SetName(const char* name = "")
{fName = name;}
void SetLabelColor(Int_t labelcolor)
{fAxis.SetLabelColor(labelcolor);}
void SetLabelFont(Int_t labelfont)
{fAxis.SetLabelFont(labelfont);}
void SetLabelOffset(Float_t labeloffset)
{fAxis.SetLabelOffset(labeloffset);}
void SetLabelSize(Float_t labelsize)
{fAxis.SetLabelSize(labelsize);}
void SetTitleOffset(Float_t titleoffset = 1)
{fAxis.SetTitleOffset(titleoffset);}
void SetTitleSize(Float_t titlesize)
{fAxis.SetTitleSize(titlesize);}
void SetLineColor(Color_t linecolor)
{fAxis.SetLineColor(linecolor);}
void SetLineWidth(Width_t linewidth)
{fAxis.SetLineWidth(linewidth);}