Skip to content

Plotting histograms

Plotting histograms#

The cubix canvas#

The Cubix canvas is a standard ROOT canvas with additional options that can be accessed by right clicking on the canvas. By default, frame elements cannot be modified (frame size, colors, etc.). To be able to modify the frame, use the option SetPickable from the right-click menu.

Draw options#

To plot a histogram, double click on it. It will be displayed using the Draw Option written on the top of panel 2.

The draw options are the standard ROOT options, with a few more possibilities:

  • norm: Normalize the histogram in area,
  • add: add the histogram to the current one,
    • add(2) will add the histogram with factor 2,
  • div: divide the histogram with the current one,
    • div(2) will divide the histogram with factor 2,
  • mult: multiply the histogram with the current one,
    • mult(2) multiply the histogram with factor 2,

Draw options can be combined: for example, "hist norm same" will draw the selected histogram, normalized, on the same pad as the current histogram.

ASCII files can also be interpreted as ROOT spectra. Extensions should be ".asc", ".ascii", ".txt" or ".dat"

Histogram manipulations#

A color wheel with default colors suggested by ROOT is integrated in Cubix (see the ROOT article). To change the color of a histogram using these colors, press c with the histogram under the cursor.

Histograms can be cut/copy/paste from one canvas to another. Right click on the histogram and select cut/copy, and then on another canvas, right click: paste.

A histogram can be removed from the current pad without being deleted by using right click: Undraw

A histogram already plotted in the canvas can be normalized or scaled using right click: Normalize/Scale

If the cursor is on a histogram, pressing SHIFT + wheel up/down scales the histogram up or down.

A raw histogram can be calibrated (if the calibration function has been defined in the current Workspace), using right click: Apply calibration

Zoom utilities#

Some tools have been added to the standard ROOT possibilities.

  • With the Shift key staying pressed, a click+slide with the mouse will draw a box on the canvas. When releasing the mouse click, the x range of the box will be applied to the histogram

  • With the Shift key pressed, a click on the canvas will make the range between zero and the clicked energy value.

  • With the Shift key pressed, a double click will unzoom the x axis.

  • On multi-pad canvases, adding Ctrl+Shift applies the same zoom to all pads.

  • When a zoom is applied on the X-axis (for 1D) or X and Y (for 2D), the keyboard arrows allow to move on the histogram with the same zoom.

  • The wheel up/down allows you to zoom in/out on the Y axis of a 1D histogram (the cursor needs to be anywhere except on an axis).

  • An X-axis range can be saved using z and applied to another histogram using Z.

Keyboard shortcuts#

A large number of keyboard shortcuts are available.

There is one known issue with keyboard shortcuts.

If a text zone has been clicked (like Draw Options, ENSDF nuclei...), instead of applying the keyboard shortcut, it will write the text in the text entry. This issue cannot be fixed. The only known solution for this is to switch to another window (like the terminal), and switch again on the cubix window to recover the ability of using keyboard shortcuts.

Find below the list of available shortcuts:

Key Result
CTRL+i Print the shortcuts info in the terminal
Histogram manipulation
c Increment the color of the histogram under cursor
CTRL+c Copy histogram under cursor
CTRL+x Cut histogram under cursor (copy and undraw)
CTRL+v Paste the copied histogram in the current canvas (add to current ones)
CTRL+d Undraw histogram under cursor
SHIFT+s Add the spectrum under the cursor to the saved list
CTRL+n Normalize histogram under cursor in area
CTRL+m Normalize histogram under cursor to the maximum
SHIFT+wheel Scale histogram under cursor
Canvas manipulation
n Open a new canvas
CTRL+g set/unset grid on X and Y axes
SHIFT+c set/unset CrossHair (wheel click to measure distances)
CTRL+u Update canvas
z Save the current X-axis range
Z Apply the saved X-axis range
F12 Unzoom
F9 set/unset log scale on X axis
F10 set/unset log scale on Y axis
F11 set/unset log scale on Z axis
Arrows Move on axis under cursor
Peak utilities
s Peak search (see Peak fitter section)
f Start a new fit definition (see Peak fitter section)
l+f last fit, to redo exactly the same last fit on a new histogram
CTRL+f Perform the fit for the selected peaks (or double click)
CTRL+a Start the calibration utility
c Clear current fits and peak search values
r Remove the arrow (from peak search or ENSDF) under the cursor
Gamma-Gamma mode
g Add a gate
g+g Add a gate (open a dialog to set energy and width)
b Add a background
b+b Add a background (open a dialog to set energy and width)
c Clear all gates and background
d Remove the gate under the cursor
p Project