35.12. Create Scientific Figures
Table of Contents
Choosing What to Show
In a final project the scientific figures are not decoration, they are the main way you communicate what your Geant4 simulation achieved. Before opening any plotting tool, decide what each figure is supposed to answer. Examples are how dose varies with depth, how the detector energy spectrum looks, or how shielding reduces a flux.
Treat every figure as an answer to one clear question. If you cannot express that question in a short sentence, the figure is probably trying to do too much at once. This discipline will guide what you plot, what axes you use, and how much detail you include.
Once you know the scientific question, identify the exact quantities from your simulation that are needed. These will usually come from histograms, ntuples, or ROOT trees produced by your Geant4 analysis code. For example, if you want a depth dose curve, you might need energy deposited per slice of a phantom, normalized per incident particle or per unit mass.
A scientific figure must convey a single clear message. Decide the question first, then design the plot around that one message.
From Simulation Data to Plottable Quantities
Geant4 produces raw data: hits, energy deposits, times, positions, particle IDs, and sometimes directly filled histograms. To make a useful figure, you often need to transform this raw output into more physical or more intuitive quantities.
Common transformations include converting total energy deposition into dose, counting events that satisfy a condition, or computing efficiencies and ratios. You may also need to apply selection criteria identical to those you would use in an experiment, such as an energy window for valid detections.
The table below gives some examples of simulation outputs and the derived quantities that are often plotted.
| Simulation data (raw) | Derived quantity for figure |
|---|---|
| Energy deposition per voxel, number of primaries | Dose vs depth, dose maps |
| Detector hit energies | Energy spectrum, peak position and resolution |
| Hit positions and times | Spatial distributions, coincidence timing, time of flight |
| Number of transmitted particles | Transmission vs thickness, attenuation length |
| Coincidence pairs in PET | Sinograms, lines of response distributions |
Think about units already when you derive these quantities. If you want to show dose, convert to Gy. If you want energy, convert to keV or MeV using the Geant4 unit system in your analysis step before writing to file. This makes consistent axis labeling easier at the plotting stage and avoids confusion later.
Always convert internal Geant4 units to physical units before plotting, and keep track of normalizations such as per primary particle or per unit mass.
Plot Types for Common Geant4 Results
Most final project figures will fall into a few standard categories. Choosing a conventional representation helps readers understand your work quickly and allows easier comparison with literature or experimental data.
For an energy spectrum from a detector, use a 1D histogram of counts versus energy. A linear energy axis is common, but a logarithmic count axis can be useful if the spectrum spans several decades. For dose as a function of depth in a phantom, use a line plot of dose versus depth, often with error bars if you estimate statistical uncertainties.
Shielding or attenuation studies are usually shown as transmission or attenuation coefficients versus material thickness or energy. Use clear markers for simulation results and, if available, overlay reference curves from analytical models or measurements.
Spatial distributions such as dose maps or hit densities are best shown as 2D color maps, where position coordinates form the axes and the color encodes the quantity of interest. In PET or imaging examples, you might also show 2D projections of event counts or reconstructed images.
Timing information such as time of flight or coincidence timing is often represented as a histogram of counts versus time difference. If your project studies detector resolution, show how the width of this distribution changes with different detector parameters.
Use standard plot types: histograms for spectra and timings, line plots with error bars for curves, and 2D color maps for spatial distributions. Avoid unusual or decorative plot styles that make interpretation harder.
Essential Elements of a Scientific Figure
Every scientific figure should be understandable on its own, without reading the caption or the surrounding text. You achieve this with careful choice of axes, labels, and annotations.
First, choose meaningful axes and set appropriate ranges. Make sure the full behavior of interest is visible. Do not crop the peak you want to discuss, and do not include such wide ranges that the interesting part becomes tiny. Decide if linear or logarithmic scales are appropriate. If you use logarithmic axes, make sure values are strictly positive.
Second, label axes with both quantity and unit. For example, write "Energy [MeV]", "Depth in water [mm]", or "Time difference [ns]". Avoid ambiguous or internal variable names. The units should match the conversions you implemented when processing Geant4 output.
Third, if you include more than one dataset in a figure, add a legend describing each curve or histogram. Use descriptive names, such as "Simulated, 5 mm lead" or "Data, 2 cm Al", not just "curve1". If curves represent different materials or parameter values, make that explicit.
Grid lines and reference lines can sometimes aid interpretation, but use them sparingly. If the key message is a comparison to a known value, for instance a theoretical range or threshold, you may draw a vertical or horizontal line at that value and label it in the figure or caption.
Every plot must have labeled axes including units. If there is more than one curve or histogram, include a clear legend that explains each one.
Showing Uncertainty and Statistics
Monte Carlo simulations are statistical by nature. A convincing scientific figure shows not only central values but also some information about uncertainties. This is essential if you want to compare different configurations or to experimental data.
For histograms, the simplest representation of statistical uncertainty is an error bar equal to the square root of the number of counts in each bin, if events are independent. Many plotting tools can display these automatically. For quantities derived from multiple events such as a mean dose per slice, use the standard error of the mean and plot it as vertical error bars on a line plot.
If you compare two simulations, show whether their error bars overlap. If you compare simulation with experimental data or analytic calculations, include both sets with uncertainties so that differences can be interpreted correctly.
Sometimes too many error bars can clutter the plot. In that case you can show uncertainties only at selected points, such as every few bins, or summarize them with separate panels or insets. Make sure this does not hide important information.
Do not present smooth curves without indicating statistical uncertainties. Include error bars or some other visible representation of Monte Carlo statistics whenever you draw quantitative conclusions.
Consistent Style Across All Figures
A final project usually contains several figures. To make your work look coherent and professional, adopt a consistent visual style and apply it to all plots.
Use the same color convention for the same physical objects or conditions. For example, if you represent water with blue and lead with gray in one figure, reuse these colors everywhere. If one configuration is always the "baseline", keep it the same color and marker across all plots. This consistency helps readers follow comparisons.
Choose readable fonts and sufficient font size for axes, labels, and legends. The text should remain legible when the figure is included in a document or presentation. Avoid font sizes that are barely readable on a printout.
Limit the number of distinct colors and line styles in a single figure. Too many curves make it impossible to distinguish the message. It is usually better to split a very crowded figure into two clearer ones than to compress everything into one.
Maintain consistent units and notation throughout the project. If you use MeV for energy and mm for length in one figure, use the same units in all other figures unless there is a strong reason to change. Use the same symbols for recurring quantities, such as $E$, $x$, or $t$.
Choose a consistent visual style: the same colors, line types, fonts, and units across all figures. Inconsistency makes figures harder to interpret and reduces the perceived quality of your work.
Comparisons and Validation Plots
For a final project, some of the most important figures demonstrate validation: how well the Geant4 simulation reproduces known results. These figures are especially powerful if they show both simulation and reference data in the same coordinate system.
When comparing simulation with experiment, plot both data sets together. Use different markers or line types, such as points with error bars for experiment and smooth lines for simulation. Make sure both are normalized consistently. For example, normalize an energy spectrum to the same area, or present dose per incident particle in both cases.
If you compare with analytical models, add a simple theoretical curve to your plot. Examples are exponential attenuation as a function of thickness, the shape of a Bragg peak from a simple stopping power model, or the Compton edge in a gamma spectrum. Switching between linear and logarithmic scales may reveal agreement or disagreement in different regions.
When results differ, point this out in the figure or caption. Draw attention to deviations rather than hiding them. These differences can become interesting discussion points in the analysis section of your report.
When validating your simulation, always show simulation and reference results on the same plot with the same normalization. Visual side by side comparison is far more convincing than separate figures.
Preparing Figures for Reports and Presentations
Once your plots look correct on screen, you still need to export them in formats suitable for reports, theses, or slides. Different contexts may require different file types.
For printed reports and PDFs, vector formats such as PDF or SVG preserve line sharpness and text quality when scaled. Many analysis tools, including ROOT, can export plots directly to these formats. For slides or web pages, high resolution PNG images are often sufficient, but ensure that the resolution is high enough so that text remains readable.
Before exporting, adjust the aspect ratio so that the figure will not look stretched when inserted into a document. Remove unnecessary margins around the plot area so that space is used efficiently. Check that the background is appropriate: a white or light background is usually best for printed documents.
Make sure all labels and ticks are visible and not cut off at the edges of the exported image. If you include color maps, verify that the color scale and corresponding color bar are included and labeled with units.
Finally, save your plotting script or macro along with the figure, so you can reproduce the same plot if you need to change data, improve statistics, or correct an error.
Export figures in publication-quality formats, check that all text is readable and not cut, and always keep the script or macro that produced the figure so you can reproduce it later.
Captions and Figure Documentation
The figure itself should be as self-explanatory as possible, but the caption is where you clearly state what the figure shows and why it matters.
A good caption has three parts. First, a short description of what is plotted, for example "Simulated energy spectrum of a 662 keV gamma source in a NaI detector." Second, a brief note on the conditions or main parameters, such as the geometry, material, and number of events, especially if they are not obvious from the axes. Third, a statement of the main conclusion, for example "The main photopeak is observed at 660 keV with a FWHM of 7 percent."
If the plot includes multiple curves or datasets, specify in the caption what each represents, even if the legend exists. This redundancy helps readers who print pages in black and white or who may not see colors clearly.
Keep a link in your project notes between each figure and the code or analysis step that created it. Note which Geant4 version, which macro settings, and which random seeds were used. In a long project, this documentation prevents confusion when you revisit results later.
Write captions that describe what is plotted, under which conditions, and what the main takeaway is. Document how each figure was produced so you can trace it back to the corresponding simulation and analysis.
Views: 7
KAHIBARO