9.5. Publication-Quality Figures
Table of Contents
Clean scientific plots
Publication-quality figures start with clarity. A reader should understand the main message of a plot within a few seconds, without needing to guess what is being shown or which dataset is which. In ROOT this usually means simplifying your plots and making every visual element serve a purpose.
Begin by removing unnecessary clutter. Avoid default statistics boxes on final plots unless the numbers are directly relevant to the message. You can turn them off globally with a style, for example setting gStyle->SetOptStat(0), or disable them for individual histograms. Similarly, remove fit result boxes on final figures unless the parameters are essential to the argument, and consider reporting numerical values in the caption or text instead.
Axis titles must clearly state the quantity and unit. Use descriptive names instead of cryptic variable names. For example, instead of “E” use “Energy $E$ [GeV]”, and instead of “N” use “Number of events”. Write mathematical symbols using TLatex syntax so that ROOT renders them in a familiar scientific style, for instance #it{p}_{T} for transverse momentum. Choose LaTeX-like notation that is common in your field and use it consistently in all plots.
Tick labels should be readable at the final printed or embedded size. ROOT defaults are usually too small for journal figures, so increase label and title sizes for both axes before you draw the objects. A common workflow is to configure axis fonts and sizes via TStyle and then create histograms and graphs so that they inherit the settings. If you resize a canvas significantly, you may need to adjust label sizes again to keep them legible.
Decide appropriate axis ranges instead of relying on defaults. The range should include all relevant data while avoiding large empty regions that waste space and make features look small. When plotting histograms, it is often clearer to start the vertical axis at zero so that bar heights are directly comparable, unless you have a specific reason not to. Check underflow and overflow bins to be sure that important data are not hidden off the visible range.
When overlaying several histograms or graphs, avoid using too many lines or markers in a single panel. If there are more than three or four datasets, consider splitting the information into multiple panels or using ratios and residuals. Use contrasting colors and line styles so that each dataset is easy to distinguish both on screen and in black-and-white print. In particle physics it is common to combine line style and marker type, for example one dataset with solid line and filled circles and another with dashed line and open squares.
Legends and labels should help the interpretation without blocking the data. Place the legend where it covers the least interesting region of the plot, and adjust its background and border so that it is visible but does not dominate. For annotations use TLatex or TText to add experiment names, selection criteria, and other relevant information directly in the figure. Keep these texts short and use a size similar to axis labels so that the plot remains balanced.
Sometimes clean presentation requires transforming the axes. Logarithmic scales can reveal structure across many orders of magnitude, but you must ensure that you do not plot zeros or negative values on log axes. For log plots, label tick marks clearly and check that minor tick marks look reasonable. When showing ratios or residuals beneath a main panel, make sure that the vertical range of the lower panel focuses on the interesting deviations instead of defaulting to a wide range that makes all points look flat.
Finally, always inspect the final rendered figure at the size and format you intend to use in a report or publication. Subtle overlaps, unreadable labels, or poorly chosen colors often become apparent only when you look at the figure as the reader will see it.
For clean scientific plots in ROOT, always ensure: clear and unit-labelled axes, readable fonts, minimal clutter from stats or fit boxes, carefully chosen axis ranges, and distinct, non-confusing styles for overlaid datasets.
Consistent formatting
Consistency across all figures in a paper or presentation is as important as the correctness of each individual plot. A consistent visual language makes it easier for the reader to compare plots and reduces cognitive load. In ROOT the main tool for ensuring consistency is TStyle, which lets you define global style settings that apply to canvases, histograms, graphs, and other objects.
A good starting point is to create a small C++ source file or macro where you define your “analysis style”. In that file, you can create a TStyle object and configure axis fonts and sizes, line widths, marker styles, color palettes, padding, and margins. Apply this style at the beginning of every analysis or plotting macro by calling gROOT->SetStyle("YourStyleName") and gROOT->ForceStyle(). Doing this ensures that newly created objects adopt the same style automatically.
Font choices should be uniform across all plots. ROOT uses numeric font codes that combine font family and precision. Decide once which font you will use, for example a simple sans serif font, and apply it to titles, labels, and text elements. Use the same relative font sizes for axis titles, axis labels, legends, and annotations so that the hierarchy of information is clear. If axis titles are larger than labels in one figure, they should be larger in the same proportion in every figure.
Line and marker styles also need a consistent scheme. Choose a set of line widths that are visible in both screen and print formats and reuse them. A common choice is to use slightly thicker lines than ROOT defaults for main curves, and thinner lines for auxiliary references such as fits or background shapes. Define a small palette of marker types and colors that you always assign in the same way, for example data points as black circles, simulation as colored lines, and systematic variations as bands or dashed lines.
Colors should be readable in both color and grayscale. When you choose colors for histograms and graphs, test how they look if converted to black and white or viewed by someone with color vision deficiency. Avoid relying on red and green as the only distinction. Instead, combine color with line style and marker shape. For filled histograms, use light fills with strong outlines, or semi-transparent fills if overlaid, so that overlapping regions remain visible. ROOT allows adjusting fill styles and alpha transparency to achieve this effect.
Canvas sizes, margins, and aspect ratios should be standardized, especially for figures that will appear together. Many journals have recommended aspect ratios and font sizes, and you can match them by setting the canvas pixel dimensions and pad margins. Use the same top, bottom, left, and right margins across plots so that axis titles and labels align when figures are placed next to each other. When using divided canvases with multiple pads, adjust internal margins so that labels do not overlap and spacing is uniform.
For multi-panel figures it is common to use shared axis ranges and styles. If you show the same variable across several conditions, use identical axis limits and tick marks so that visual differences reflect physics rather than plotting choices. In ROOT you can explicitly set the axis ranges for all panels instead of relying on automatic scaling, and you can disable redundant labels on inner panels if necessary while keeping outer panels fully labelled.
Legends and annotations should follow a consistent order and wording. For instance, always list datasets in the same sequence in legends, such as data first, then main simulation, then alternative models. Use the same labels for the same quantities throughout, for example “Data 2018” in every plot that uses that dataset, not “Run 2018” in one figure and “2018 data” in another. Consistency in text makes the reader trust that similar labels mean the same thing.
Finally, document your chosen style within your analysis code. Keep the style configuration in a dedicated file that is version controlled along with your macros. This way, if you revisit the analysis months later or share it with collaborators, you can reproduce the same look for all plots. A single, shared style macro used by the whole collaboration can greatly simplify producing a coherent set of publication-quality figures.
Use a single ROOT TStyle to define fonts, sizes, colors, line widths, marker styles, canvas margins, and axis ranges, and apply it to every plot so that all figures share a consistent and recognizable visual style.
Exporting vector graphics
Once a plot looks correct on screen, you need to export it in a format suitable for publication. For scientific papers and many reports, vector graphics formats are preferred, because they preserve sharp lines and text at any zoom level and scale well when resized. ROOT supports several output formats including PDF and SVG, which are both vector formats, as well as bitmap formats such as PNG and JPG.
The simplest way to export is via the TCanvas SaveAs method. After you finish drawing your histograms and graphs and updating the canvas, you can save to a file by calling canvas->SaveAs("figure.pdf"). The extension determines the file format. For publication-quality vector graphics, PDF is often the safest choice, because most journals and document preparation systems handle PDF figures well. SVG can be useful if you plan to edit the figure further in vector graphics software or embed it in web pages.
When exporting vector graphics, check that all elements in the canvas use fonts and sizes that are acceptable for your target. In a vector file, axis labels and TLatex annotations are stored as text objects, which means they stay sharp at any resolution but can look too small or too large if you did not set them properly. It is a good practice to open the resulting PDF or SVG in a viewer and inspect it at 100 percent and at higher zoom to ensure that text is readable and that objects are positioned correctly.
If you are using LaTeX to write your paper, including ROOT-generated PDFs is usually straightforward. However, you should be aware that fonts in the ROOT PDF may not match the fonts in the rest of your document. Some authors accept this difference, while others configure ROOT to use fonts closer to their LaTeX document or use external tools to adjust text. In any case, exporting as PDF avoids rasterization and keeps curves and axes crisp.
For journals that still request EPS (Encapsulated PostScript), you can either export directly if your ROOT version supports it, or export to PDF and convert to EPS with external tools. Conversions can sometimes alter bounding boxes or fonts, so recheck the figure after conversion. The important point is that you keep the figure as a vector representation at each stage so that resolution is not lost.
Even if your final figures are vector, it is useful to also save high-resolution bitmap versions for quick sharing, slides, or internal notes. You can call SaveAs("figure.png") or specify pixel dimensions by setting the canvas size appropriately when you create it. For slides, a PNG is often sufficient, but remember that enlarging a low-resolution bitmap will make it appear blurry, while enlarging a vector PDF or SVG will not.
ROOT can also save canvases in its own .C or .root formats. While these are not publication formats, they are invaluable for reproducibility, because they preserve all objects in the canvas along with their styles. You can combine this with exporting vector graphics: save a .root file for internal use and a .pdf or .svg for publication. Later, if you need to adjust a label or color, you can reopen the ROOT file, modify the canvas, and export again without rerunning a long analysis.
Sometimes vector exports reveal issues that were not obvious in the interactive window, such as overlapping labels or misaligned subpads. Treat the exported vector file as the reference and, if necessary, adjust margins, text positions, and legend locations in your code until the exported figure looks clean. Iterating a few times at this stage is common and can make a significant difference in the professional quality of the final figures.
For publication-ready output from ROOT, export canvases to vector formats such as PDF or SVG using TCanvas::SaveAs, verify font sizes and layout in a PDF or SVG viewer, and keep a corresponding ROOT or C macro version to allow easy regeneration of improved figures.
Views: 11
KAHIBARO