Skip to content

Meta Plotting with gen-plot

This tutorial updates the older plotter ... style to the current presentation workflow command:

reaxkit gen-plot --type <plot_type> ...

gen-plot is file-agnostic: it reads tabular files and plots by column selectors (c1, c2, ...), without requiring ReaxFF-specific semantics. As a result, it can be used for any tabular data.


Supported plot types

  • single which is a flexible line/scatter plot with multiple series and shared x-axis
  • directed which is a directed curve plot with arrows indicating directionality along the curve
  • dual which is a dual y-axis plot
  • tornado which is a tornado plot
  • scatter3d which is a 3D scatter plot with optional value-based coloring
  • heatmap2d which is a 2D heatmap generated from 3D coordinates by projecting onto a plane and binning

All are selected through --type.


Manuscript plot styles

Plotting workflows that use the shared renderer accept --plot-style {default,publication,publication-bold}. The option applies to every figure generated by that invocation, including all curve and bar collections in get_ffield_opt_plots and the standalone get_ffield_opt_eos command.

Style Text Lines / markers Colors
default Existing appearance Existing appearance Existing appearance
publication 12 pt ticks and legends, 14 pt labels and titles 2 pt / 6 pt Blue/red palette
publication-bold Bold 14 pt ticks, 13 pt legends, 17 pt labels and titles 2.6 pt / 7.5 pt Saturated blue/red palette

The publication presets use Arial with Helvetica/DejaVu Sans fallbacks, black text, stronger axes and tick marks, opaque bars, white backgrounds, and no background gridlines. For individual figures wider than 8 inches, sizes grow in proportion to the width so that wide bar charts retain legibility when reduced. Subplot sizes remain per-panel. Neither preset changes the scientific values.

reaxkit get-ffield-opt-plots --plot-style publication-bold --output manuscript_plots
reaxkit get_ffield_opt_eos --iden all --plot single --plot-style publication --save eos_plots
reaxkit gen-plot --type single --file summary.txt --xaxis c1 --yaxis c2 --plot-style publication-bold --save figure.svg

New raster exports use 600 dpi under either publication preset. Commands accepting an individual output filename can export PDF or SVG instead: PDF embeds TrueType fonts (type 42), while SVG retains text as text. The aggregate optimization workflow continues to produce PNG collections with its existing filenames.

These are general manuscript presets, not journal certification. The supplied Nature figure guide recommends accessible colors, standard sans-serif fonts, editable vector text, and 5-7 pt text at final publication size. The Wiley before/after examples likewise emphasize readability after reduction. Check the figure at its actual size in the manuscript: reducing a 6-inch figure to 3 inches halves its font and stroke sizes. Bold is an optional presentation choice, not a universal journal requirement. For crowded categorical plots, reduce --entry-per-figure (for example, to 3).

For Python callers, use plot(payload, style="publication-bold"), put "plot_style": "publication" in the payload, or wrap several calls in reaxkit.presentation.plot_styles.plot_style_context("publication"). Explicit per-series line widths, marker sizes, alpha values, and custom colors are retained. The built-in ReaxFF/QM blue and muted red colors are replaced by the preset palette. An explicit plot_style="default" opts out of an inherited style. The single source of truth for presets is reaxkit.presentation.plot_styles.PLOT_STYLES; Matplotlib settings are restored after each render. Direct third-party plotting and interactive web charts are outside this renderer's style system.

To generate synthetic EOS and reaction-energy previews of all three styles, run python docs/examples/plot_styles_example.py --output plot_style_examples from the repository root using the project environment.

PowerPoint collections

Add --make-powerpoint (alias --make-ppt) to assemble the generated optimization figures into a deck:

reaxkit get-ffield-opt-plots --plot-style publication-bold --make-powerpoint --output manuscript_plots

This writes manuscript_plots/ffield_opt_plots.pptx. Each nonempty category starts with a title slide, followed by one figure per slide. Figures retain their plot style and aspect ratio. EOS figures from material subfolders are included, and the two figure types in other_bar_plots share one section. Only images generated by this invocation are included. If no figures are generated, no deck is written. The headings are editable PowerPoint text; plots are embedded images.


Input model

gen-plot accepts text/CSV/TSV tables: - CSV/TSV or whitespace-delimited text - optional comment lines with # - columns referenced with 1-based tokens (c1, c2, ...)


Core examples

1) Single line/scatter plot

To get a simple line plot of column 2 vs column 1:

reaxkit gen-plot --type single --file summary.txt --xaxis c1 --yaxis c2 --plot

Multi-series with shared x:

reaxkit gen-plot --type single --file summary.txt --xaxis c1 --yaxis c2,c3,c4 --plot

Pairwise x-y mode, meaning c1 vs c2 and c3 vs c4:

reaxkit gen-plot --type single --file data.txt --xaxis c1,c3 --yaxis c2,c4 --plot

Use markers instead of lines:

reaxkit gen-plot --type single --file data.txt --xaxis c1 --yaxis c2 --scatter --plot

2) Directed curve

This type of plot is useful for visualizing gradients or trajectories where the direction of change along the curve is important. Arrows are automatically placed along the curve to indicate directionality.

reaxkit gen-plot --type directed --file summary.txt --xaxis c1 --yaxis c2 --save directed.png

3) Dual y-axis

reaxkit gen-plot --type dual --file summary.txt --xaxis c1 --y1 c2 --y2 c3 --save dual_plot.png

4) Tornado

reaxkit gen-plot --type tornado --file results.txt --label c1 --min c2 --max c3 --median c4 --top 10 --save tornado.png

5) 3D scatter

reaxkit gen-plot --type scatter3d --file points.txt --x c1 --y c2 --z c3 --value c4 --save scatter3d.png

6) 2D heatmap from 3D coordinates

reaxkit gen-plot --type heatmap2d --file points.txt --x c1 --y c2 --z c3 --value c4 --plane xz --bins 100,80 --save heatmap_xz.png

Output behavior

  • --plot displays interactively
  • --save writes figure to file
  • you can use both
  • if neither is given, no plot artifact is produced

Data cleaning behavior

Before plotting, selected columns are coerced to numeric (where applicable) and invalid rows are dropped. If no valid rows remain, the command exits with a clear error.


Handoff to video generation

When you save frame sequences, use:

reaxkit gen-video --folder <frames_dir> --output output.mp4 --fps 10

This keeps plotting (gen-plot) and video composition (gen-video) as two clean, composable steps.


Back to Tutorials