You are here

2D Graphics

The ROOT basic graphics covers all the 2D graphics rendering and also some 3D features. The most advanced 3D graphics is based on OpenGL. The 2D graphics is implemented by several modules:

  • graf2d: the entire module contains 2D graphics functionalities.
    • asimage: is the interface to the libAfterImage package. It provides tools to create bitmap pictures, manipulate them, and save them in various kind of bitmap files.   
    • gpad: contains all classes dealing with graphics pads.
    • graf: the classes producing graphics sit there.
    • postscript: as its name tells the classes sitting in this module allow to produce Postscript files, but not only, it also contains the classes to produce PDF files, SVG files and all kind of binary files (gif, jpeg, png ...) thanks to the classes in the module asimage.
    • qt, x11, x11ttf: these modules are the interfaces to the low level graphics package (X11 like) available.
  • histpainter: is a sub-module of the hist module. It provides the classes to paint histograms and graphs.
  • treeviewer: is a sub-module of the tree module. It provides the tools to display trees and contains some special classes to render them as spider plots, candle plots and parallel coordinates plots.
  • base: is a sub-module if the core module. It contains all the classes managing the graphics attributes and the graphics styles.

The ROOT 2D graphics relies on the concept of Graphics Pad. All the graphics produced by ROOT is rendered in a Graphics Pad often simply called Pad. The visualization tools ROOT provides can be classify in two categories:

  1. The Basic Graphics Primitives, there are four of them, the Polylines, the Filled Areas, the Polymarkers and the Text. All the graphics produced by ROOT is a combination of these four basics elements.
  2. The High Level Graphics Primitives are build using the Basic Graphics Primitives and often derive from one or several of them. As examples we can list the Boxes, the Paves, TLatex, the Axis, ...
These two categories are combined when objects like histograms or graphs are drawn. To draw an histogram one single line of C++ code is needed: h->Draw() and one single object is stored in the current Graphics Pad. But at painting time, many different Basic Graphics Primitives and High Level Graphics Primitives are generated (axis, text, lines, pave text etc ...).

The output can be produced on screen, on vector graphics output files like PDF or Postscript files, on binary picture files.

ROOT is also able to load bitmap images and to manipulate them (through the libAfterImage library).

The pictures galleries give a good idea of what can be done.