Skip to content

4. How to Use batplot

General Command Structure

batplot command follows this pattern:

batplot  [path/]/[files...]/[keyword]  [--flags]

Component

Description

path/

Optional. A folder path when data is not in the current directory. batplot looks for supported files in that folder.

files...

One or more data files to overlay.

keywords

Special keywords: allfiles (all supported files), allxyfiles (only .xy), allnorfiles (only .nor), etc.

--flags

Options that control mode, axes, styling, and output. All flags use the double-dash (--) prefix.

Getting Help

To see batplot help and documentation:

batplot --help           # General help

Figure 6: Help message

batplot --help xy        # 1D / XY mode help
batplot --help ec        # Electrochemistry mode help
batplot --help op        # *Operando* mode help
batplot --help histo     # Histogram mode help
batplot --version        # Version and release notes

Figure 7: Version check

batplot --manual         # Open the online user manual

As navigating to different paths can sometimes be tedious, you can create a folder named "Figures", and use cd to navigate to this "Figures" path. Then, you can directly drag the files/copy the path into the terminal for interactive plotting. Inside interactive menu, you can easily save the plot session/export the figure/export the style/import a style from the "Figures" folder as batplot automatically detects your terminal path and use that to save or find relavant files. For example:

batplot drag/the/file.xy --i
batplot drag/the/path --operando --i

Selecting Modes

The plotting mode is determined by which mode flag you include:

Mode

Flag(s) to add

1D / XY (default)

no mode flag needed; optional --xaxis / --wl when you want a named axis type or XRD conversion

Galvanostatic cycling

--gc

Cyclic voltammetry

--cv

Differential capacity

--dqdv

Capacity/Energy density per cycle

--cpc / --epc

Operando / contour

--operando or --contour

Histogram

--histo

The Interactive Menus

Customized interactive menus are the central feature that makes batplot unique. Add --i to any command to open a text-driven menu in the terminal alongside the live figure window. Every change you make — colors, fonts, axis labels, line widths, tick spacing — updates the figure in real time.

Full key + subkey reference (per mode — open the chapter you use):

Mode Where every key is introduced
1D / XY Ch.5 Interactive menu
GC / CV / dQ/dV Ch.6 EC menu
CPC Ch.6 CPC menu
Operando Ch.7 Operando menu
Histogram Ch.8 Histogram menu
Batch Ch.9 Batch menus

Index page: Interactive menus.

batplot file.txt --i

Figure 8: 1D mode

batplot file.csv --gc --i

Figure 9: GC mode

batplot file.csv --dqdv --i

Figure 10: dQ/dV mode

batplot file.csv --cpc --i

Figure 11: CPC mode

batplot --operando --i
batplot --contour --i

Figure 12: Operando/contour mode

Inside interactive menus you can also:

  • Press p to export style and i to import (.bps / .bpsg; histogram .bpsh).
  • Press s to save the session as a .pkl file.
  • Press e to export the figure; b to undo.
  • Use every mode-specific key documented in that mode’s chapter (links in the table above).

Useful prep utilities before plotting: --showcol, --strip-header, --convert (2θ / Q / d export). For exporting every file in a folder as its own figure, see --all batch export. For editing many saved sessions at once, see Batch mode.

Note

By default, style files (.bps, .bpsg) and image files (.svg, .png, etc.) are exported into a subfolder within the selected path, while session files (.pkl) are exported directly to the selected path.

When using i to import a style file, batplot automatically scans the style subfolder in the current path, lists the detected files with numbers, and allows you to select a file by typing its corresponding number.

Download Tutorial Files

Below sections are some examples of how to use batplot, you can find the demo files in this link.