ROOT logo
ROOT » TREE » TREEVIEWER » TParallelCoord

class TParallelCoord: public TNamed


Parallel Coordinates class

The multidimensional system of Parallel coordinates is a common way of studying high-dimensional geometry and visualizing multivariate problems. It has first been proposed by A. Inselberg in 1981.

To show a set of points in an n-dimensional space, a backdrop is drawn consisting of n parallel lines. A point in n-dimensional space is represented as a polyline with vertices on the parallel axes; the position of the vertex on the i-th axis corresponds to the i-th coordinate of the point.

This tool comes with a rather large gui in the editor. It is necessary to use this editor in order to explore a data set, as explained below.

Reduce cluttering:

The main issue for parallel coordinates is the very high cluttering of the output when dealing with large data set. Two techniques have been implemented to bypass that so far:

  • Draw doted lines instead of plain lines with an adjustable dots spacing. A slider to adjust the dots spacing is available in the editor.
  • Sort the entries to display with a "weight cut". On each axis is drawn a histogram describing the distribution of the data on the corresponding variable. The "weight" of an entry is the sum of the bin content of each bin the entry is going through. An entry going through the histograms peaks will have a big weight wether an entry going randomly through the histograms will have a rather small weight. Setting a cut on this weight allows to draw only the most representative entries. A slider set the cut is also available in the gui.

Selections:

Selections of specific entries can be defined over the data se using parallel coordinates. With that representation, a selection is an ensemble of ranges defined on the axes. Ranges defined on the same axis are conjugated with OR (an entry must be in one or the other ranges to be selected). Ranges on different axes are are conjugated with AND (an entry must be in all the ranges to be selected). Several selections can be defined with different colors. It is possible to generate an entry list from a given selection and apply it to the tree using the editor ("Apply to tree" button).

Axes:

Options can be defined each axis separatly using the right mouse click. These options can be applied to every axes using the editor.

  • Axis width: If set to 0, the axis is simply a line. If higher, a color histogram is drawn on the axis.
  • Axis histogram height: If not 0, a usual bar histogram is drawn on the plot.

The order in which the variables are drawn is essential to see the clusters. The axes can be dragged to change their position. A zoom is also available. The logarithm scale is also available by right clicking on the axis.

Candle chart:

TParallelCoord can also be used to display a candle chart. In that mode, every variable is drawn in the same scale. The candle chart can be combined with the parallel coordinates mode, drawing the candle sticks over the axes.

output of MACRO_TParallelCoord_1_c1
{
   TCanvas *c1 = new TCanvas("c1");
   TFile *f = TFile::Open("$ROOTSYS/tutorials/tree/cernstaff.root");
   TTree *T = (TTree*)f->Get("T");
   T->Draw("Age:Grade:Step:Cost:Division:Nation","","para");
   TParallelCoord* para = (TParallelCoord*)gPad->GetListOfPrimitives()->FindObject("ParaCoord");
   TParallelCoordVar* grade = (TParallelCoordVar*)para->GetVarList()->FindObject("Grade");
   grade->AddRange(new TParallelCoordRange(grade,11.5,14));
   para->AddSelection("less30");
   para->GetCurrentSelection()->SetLineColor(kViolet);
   TParallelCoordVar* age = (TParallelCoordVar*)para->GetVarList()->FindObject("Age");
   age->AddRange(new TParallelCoordRange(age,21,30));
   return c1;
}

Some references:

  • Alfred Inselberg's Homepage , with Visual Tutorial, History, Selected Publications and Applications.
  • A small, easy introduction by Christopher V. Jones.
  • Almir Olivette Artero, Maria Cristina Ferreira de Oliveira, Haim Levkowitz, "Uncovering Clusters in Crowded Parallel Coordinates Visualizations," infovis, pp. 81-88, IEEE Symposium on Information Visualization (INFOVIS'04), 2004.

Function Members (Methods)

public:
TParallelCoord()
TParallelCoord(Long64_t nentries)
TParallelCoord(const TParallelCoord&)
TParallelCoord(TTree* tree, Long64_t nentries)
virtual~TParallelCoord()
voidTObject::AbstractMethod(const char* method) const
voidAddSelection(const char* title)
voidAddVariable(const char* varexp)
voidAddVariable(Double_t* val, const char* title = "")
virtual voidTObject::AppendPad(Option_t* option = "")
voidApplySelectionToTree()MENU
virtual voidTObject::Browse(TBrowser* b)
static voidBuildParallelCoord(TSelectorDraw* selector, Bool_t candle)
static TClass*Class()
virtual const char*TObject::ClassName() const
voidCleanUpSelections(TParallelCoordRange* range)
virtual voidTNamed::Clear(Option_t* option = "")
virtual TObject*TNamed::Clone(const char* newname = "") const
virtual Int_tTNamed::Compare(const TObject* obj) const
virtual voidTNamed::Copy(TObject& named) const
virtual voidTObject::Delete(Option_t* option = "")MENU
voidDeleteSelection(TParallelCoordSelect* sel)
virtual Int_tDistancetoPrimitive(Int_t px, Int_t py)
virtual voidDraw(Option_t* options = "")
virtual voidTObject::DrawClass() constMENU
virtual TObject*TObject::DrawClone(Option_t* option = "") constMENU
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 entry, Int_t px, Int_t py)
virtual voidTObject::Fatal(const char* method, const char* msgfmt) const
virtual voidTNamed::FillBuffer(char*& buffer)
virtual TObject*TObject::FindObject(const char* name) const
virtual TObject*TObject::FindObject(const TObject* obj) const
Bool_tGetCandleChart()
Long64_tGetCurrentFirst()
Long64_tGetCurrentN()
TParallelCoordSelect*GetCurrentSelection()
Bool_tGetCurveDisplay() const
Int_tGetDotsSpacing() const
virtual Option_t*TObject::GetDrawOption() const
static Long_tTObject::GetDtorOnly()
TEntryList*GetEntryList(Bool_t sel = kTRUE)
Bool_tGetGlobalLogScale()
Double_tGetGlobalMax()
Double_tGetGlobalMin()
Bool_tGetGlobalScale()
virtual const char*TObject::GetIconName() const
Color_tGetLineColor()
Width_tGetLineWidth()
virtual const char*TNamed::GetName() const
Int_tGetNbins()
Long64_tGetNentries()
UInt_tGetNvar()
virtual char*TObject::GetObjectInfo(Int_t px, Int_t py) const
static Bool_tTObject::GetObjectStat()
virtual Option_t*TObject::GetOption() const
TParallelCoordSelect*GetSelection(const char* title)
TList*GetSelectList()
virtual const char*TNamed::GetTitle() const
TTree*GetTree()
virtual UInt_tTObject::GetUniqueID() const
Double_t*GetVariable(const char* var)
Double_t*GetVariable(Int_t i)
TList*GetVarList()
Bool_tGetVertDisplay() const
Int_tGetWeightCut() const
virtual Bool_tTObject::HandleTimer(TTimer* timer)
virtual ULong_tTNamed::Hash() const
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
virtual Bool_tTObject::IsEqual(const TObject* obj) const
virtual Bool_tTObject::IsFolder() const
Bool_tTObject::IsOnHeap() const
virtual Bool_tTNamed::IsSortable() const
Bool_tTObject::IsZombie() const
virtual voidTNamed::ls(Option_t* option = "") const
voidTObject::MayNotUse(const char* method) const
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)
TParallelCoord&operator=(const TParallelCoord&)
virtual voidPaint(Option_t* options = "")
virtual voidTObject::Pop()
virtual voidTNamed::Print(Option_t* option = "") const
virtual Int_tTObject::Read(const char* name)
virtual voidTObject::RecursiveRemove(TObject* obj)
voidRemoveVariable(TParallelCoordVar* var)
TParallelCoordVar*RemoveVariable(const char* var)
voidTObject::ResetBit(UInt_t f)
voidResetTree()
virtual voidTObject::SaveAs(const char* filename = "", Option_t* option = "") constMENU
voidSaveEntryLists(const char* filename = "", Bool_t overwrite = kFALSE)MENU
virtual voidSavePrimitive(ostream& out, Option_t* options)
voidSaveTree(const char* filename = "", Bool_t overwrite = kFALSE)MENU
voidSetAxisHistogramBinning(Int_t n = 100)MENU
voidSetAxisHistogramHeight(Double_t h = 0.5)MENU
voidSetAxisHistogramLineWidth(Int_t lw = 2)MENU
voidTObject::SetBit(UInt_t f)
voidTObject::SetBit(UInt_t f, Bool_t set)
voidSetCandleChart(Bool_t can)TOGGLE GETTER
voidSetCurrentEntries(TEntryList* entries)
voidSetCurrentFirst(Long64_t)
voidSetCurrentN(Long64_t)
TParallelCoordSelect*SetCurrentSelection(const char* title)
voidSetCurrentSelection(TParallelCoordSelect* sel)
virtual voidSetCurveDisplay(Bool_t curve = 1)TOGGLE GETTER
voidSetDotsSpacing(Int_t s = 0)MENU
virtual voidTObject::SetDrawOption(Option_t* option = "")MENU
static voidTObject::SetDtorOnly(void* obj)
static voidSetEntryList(TParallelCoord* para, TEntryList* enlist)
voidSetGlobalLogScale(Bool_t)TOGGLE GETTER
voidSetGlobalMax(Double_t max)
voidSetGlobalMin(Double_t min)
voidSetGlobalScale(Bool_t gl)TOGGLE GETTER
voidSetInitEntries(TEntryList* entries)
voidSetLineColor(Color_t col)
voidSetLineWidth(Width_t wid)
voidSetLiveRangesUpdate(Bool_t)
virtual voidTNamed::SetName(const char* name)MENU
virtual voidTNamed::SetNameTitle(const char* name, const char* title)
voidSetNentries(Long64_t n)
static voidTObject::SetObjectStat(Bool_t stat)
virtual voidTNamed::SetTitle(const char* title = "")MENU
voidSetTree(TTree* tree)
virtual voidTObject::SetUniqueID(UInt_t uid)
voidSetVertDisplay(Bool_t vert = kTRUE)TOGGLE GETTER
voidSetWeightCut(Int_t w = 0)MENU
virtual voidShowMembers(TMemberInspector&)
virtual Int_tTNamed::Sizeof() const
virtual voidStreamer(TBuffer&)
voidStreamerNVirtual(TBuffer& ClassDef_StreamerNVirtual_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
voidUnzoomAll()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()
private:
voidInit()
voidPaintEntries(TParallelCoordSelect* sel = NULL)
voidSetAxesPosition()

Data Members

public:
enum { kVertDisplay
kCurveDisplay
kPaintEntries
kLiveUpdate
kGlobalScale
kCandleChart
kGlobalLogScale
};
enum TObject::EStatusBits { kCanDelete
kMustCleanup
kObjInCanvas
kIsReferenced
kHasUUID
kCannotPick
kNoContextMenu
kInvalidObject
};
enum TObject::[unnamed] { kIsOnHeap
kNotDeleted
kZombie
kBitMask
kSingleKey
kOverwrite
kWriteDelete
};
protected:
TStringTNamed::fNameobject identifier
TStringTNamed::fTitleobject title
private:
TGaxis*fCandleAxis! An axis used when displaying a candle chart.
TEntryList*fCurrentEntries-> Current selected entries in the tree.
Long64_tfCurrentFirstFirst entry to display.
Long64_tfCurrentNNumber of entries to display.
TParallelCoordSelect*fCurrentSelection! Current Selection being edited.
Int_tfDotsSpacingSpacing between dots to draw the entries.
TEntryList*fInitEntries-> Selected entries when TParallelCoord first initialized.
Color_tfLineColorentries line color.
Width_tfLineWidthentries line width.
Long64_tfNentriesNumber of entries;
UInt_tfNvarNumber of variables.
TList*fSelectListList of selections over the variables.
TTree*fTree! Pointer to the TTree.
TStringfTreeFileNameName of the file containing the tree.
TStringfTreeNameName of the tree.
TList*fVarListList of the variables.
Int_tfWeightCutSpecify a cut on the entries from their weight (see TParallelCoordVar::GetEvtWeight(Long64_t))

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

TParallelCoord()
 Default constructor.
TParallelCoord(Long64_t nentries)
 Constructor without a reference to a tree,
 the datas must be added afterwards with
 TParallelCoord::AddVariable(Double_t*,const char*).
TParallelCoord(TTree* tree, Long64_t nentries)
 Normal constructor, the datas must be added afterwards
 with TParallelCoord::AddVariable(Double_t*,const char*).
~TParallelCoord()
 Destructor.
void AddVariable(Double_t* val, const char* title = "")
 Add a variable.
void AddVariable(const char* varexp)
 Add a variable from an expression.
void AddSelection(const char* title)
 Add a selection.
void ApplySelectionToTree()
 Apply the current selection to the tree.
void BuildParallelCoord(TSelectorDraw* selector, Bool_t candle)
 Call constructor and add the variables.
void CleanUpSelections(TParallelCoordRange* range)
 Clean up the selections from the ranges which could have been deleted
 when a variable has been deleted.
void DeleteSelection(TParallelCoordSelect* sel)
 Delete a selection.
Int_t DistancetoPrimitive(Int_t px, Int_t py)
 Compute the distance from the TParallelCoord.
void Draw(Option_t* options = "")
 Draw the parallel coordinates graph.
void ExecuteEvent(Int_t entry, Int_t px, Int_t py)
 Execute the corresponding entry.
TParallelCoordSelect* GetCurrentSelection()
 Return the selection currently being edited.
TEntryList* GetEntryList(Bool_t sel = kTRUE)
 Get the whole entry list or one for a selection.
Double_t GetGlobalMax()
 return the global maximum.
Double_t GetGlobalMin()
 return the global minimum.
Int_t GetNbins()
 get the binning of the histograms.
TParallelCoordSelect* GetSelection(const char* title)
 Get a selection from its title.
TTree* GetTree()
 return the tree if fTree is defined. If not, the method try to load the tree
 from fTreeFileName.
Double_t* GetVariable(const char* var)
 Get the variables values from its title.
Double_t* GetVariable(Int_t i)
 Get the variables values from its index.
void Init()
 Initialise the data members of TParallelCoord.
void Paint(Option_t* options = "")
 Paint the parallel coordinates graph.
void PaintEntries(TParallelCoordSelect* sel = NULL)
 Loop over the entries and paint them.
void RemoveVariable(TParallelCoordVar* var)
 Delete a variable from the graph.
TParallelCoordVar* RemoveVariable(const char* var)
 Delete the variable "vartitle" from the graph.
void ResetTree()
 Reset the tree entry list to the initial one..
void SaveEntryLists(const char* filename = "", Bool_t overwrite = kFALSE)
 Save the entry lists in a root file "filename.root".
void SavePrimitive(ostream& out, Option_t* options)
 Save the TParallelCoord in a macro.
void SaveTree(const char* filename = "", Bool_t overwrite = kFALSE)
 Save the tree in a file if fTreeFileName == "".
void SetAxesPosition()
 Update the position of the axes.
void SetAxisHistogramBinning(Int_t n = 100)
 Set the same histogram axis binning for all axis.
void SetAxisHistogramHeight(Double_t h = 0.5)
 Set the same histogram axis height for all axis.
void SetGlobalLogScale(Bool_t )
 All axes in log scale.
void SetGlobalScale(Bool_t gl)
 Constraint all axes to the same scale.
void SetAxisHistogramLineWidth(Int_t lw = 2)
 Set the same histogram axis line width for all axis.
void SetCandleChart(Bool_t can)
 Set a candle chart display.
void SetCurrentFirst(Long64_t )
 Set the first entry to be dispayed.
void SetCurrentN(Long64_t )
 Set the number of entry to be displayed.
TParallelCoordSelect* SetCurrentSelection(const char* title)
 Set the selection beeing edited.
void SetCurrentSelection(TParallelCoordSelect* sel)
 Set the selection beeing edited.
void SetDotsSpacing(Int_t s = 0)
 Set dots spacing. Modify the line style 11.
 If the canvas support transparency dot spacing is ignored.
void SetEntryList(TParallelCoord* para, TEntryList* enlist)
 Set the entry lists of "para".
void SetGlobalMax(Double_t max)
 Force all variables to adopt the same max.
void SetGlobalMin(Double_t min)
 Force all variables to adopt the same min.
void SetLiveRangesUpdate(Bool_t )
 If true, the pad is updated while the motion of a dragged range.
void SetVertDisplay(Bool_t vert = kTRUE)
 Set the vertical or horizontal display.
void UnzoomAll()
 Unzoom all variables.
TParallelCoord()
Bool_t GetCandleChart()
Long64_t GetCurrentFirst()
{return fCurrentFirst;}
Long64_t GetCurrentN()
{return fCurrentN;}
Bool_t GetCurveDisplay() const
Int_t GetDotsSpacing() const
{return fDotsSpacing;}
Bool_t GetGlobalScale()
Bool_t GetGlobalLogScale()
Color_t GetLineColor()
{return fLineColor;}
Width_t GetLineWidth()
{return fLineWidth;}
UInt_t GetNvar()
{return fNvar;}
Long64_t GetNentries()
{return fNentries;}
TList * GetSelectList()
{return fSelectList;}
TList * GetVarList()
{return fVarList;}
Bool_t GetVertDisplay() const
Int_t GetWeightCut() const
{return fWeightCut;}
void SetCurveDisplay(Bool_t curve = 1)
void SetCurrentEntries(TEntryList* entries)
{fCurrentEntries = entries;}
void SetInitEntries(TEntryList* entries)
{fInitEntries = entries;}
void SetLineColor(Color_t col)
{fLineColor = col;}
void SetLineWidth(Width_t wid)
{fLineWidth = wid;}
void SetNentries(Long64_t n)
{fNentries = n;}
void SetTree(TTree* tree)
{fTree = tree;}
void SetWeightCut(Int_t w = 0)
{fWeightCut = w;}