Plotting Guide
This guide covers the CARES RL plotting CLI utility, which can plot data from one task, multiple tasks, or explicit run directories. It supports multi-panel figures, dual y-axes, and a wide range of customization options.
By default, single-panel figures use a more spacious layout, while multi-panel figures and combined task comparisons use a compact publication-oriented layout. Individual figure dimensions and font sizes can be overridden from the command line.
Command Overview
Input modes:
--tasks: root directory containing multiple task directories.--task: one task directory containing comparison/run folders.--data: explicit run directories to compare as one task.
Output:
--outputis required for figure generation.
Default Figures
When no --plot options are supplied, the command generates two learning-curve
figures:
- training episode reward against total steps;
- evaluation episode reward against total steps.
For combined --tasks input, each default metric is rendered as a task-grid figure. With --task, --data, or --tasks --separate, each task receives independent train and evaluation reward figures.
Task Plotting
Plot multiple algorithms across one task:
Example:
Tasks Plotting
Plot all tasks under a benchmark root as a combined task-grid view:
Example:
Separate Tasks
Use --separate to render one figure per discovered task instead of a combined task-grid for --tasks. This is useful for large benchmarks with many tasks or when tasks have different reward scales.
Data Plotting
Plot multiple explicit run directories as one comparison task:
cares-rl-plot \
--data \
~/cares_rl_logs/SAC/SAC-HalfCheetah-v4-YY_MM_DD:HH:MM:SS \
~/cares_rl_logs/TD3/TD3-HalfCheetah-v4-YY_MM_DD:HH:MM:SS \
--output ~/cares_rl_plots
Plot Customization
Plotting options are available to customize figure layout, style, and content.
Custom Plot Panels
Use repeated --plot values to define custom panels within a figure. This enables you to plot multiple metrics on the same axes, or to create multi-panel figures with different metrics.
Supported keys:
source:trainoreval(required).y: comma-separated primary-axis columns (required).x: x-axis column (defaulttotal_steps).y2: comma-separated secondary-axis columns.title,x_label,y_label,y2_label.x_scale,y_scale,y2_scale(linearorlog).
Each specification contains semicolon-separated key=value fields:
source=<train|eval>;
x=<X_COLUMN>;
y=<PRIMARY_COLUMN>[,<PRIMARY_COLUMN>...];
y2=<SECONDARY_COLUMN>[,<SECONDARY_COLUMN>...];
title=<PANEL_TITLE>;
x_label=<DISPLAY_X_LABEL>;
y_label=<DISPLAY_Y_LABEL>;
y2_label=<DISPLAY_SECONDARY_Y_LABEL>;
x_scale=<linear|log>;
y_scale=<linear|log>;
y2_scale=<linear|log>
Only source and y are required. The default x-axis column is
total_steps.
The x_label, y_label, and y2_label values change only the displayed axis
text; they do not change which data columns are plotted.
Example --task:
cares-rl-plot \
--task ~/hpc_outputs/Tasks/ball_in_cup/ \
--output ~/cares_rl_logs/figures \
--plot "source=train;x=total_steps;y=episode_reward" \
--plot "source=train;x=total_steps;y=actor_loss" \
--plot "source=eval;x=total_steps;y=episode_reward"
Example --tasks:
cares-rl-plot \
--tasks ~/hpc_outputs/Tasks/ \
--output ~/cares_rl_logs/figures \
--plot "source=train;x=total_steps;y=episode_reward" \
--plot "source=train;x=total_steps;y=actor_loss"
Tasks and --plot
Using --tasks with --plot generates one figure per --plot, with one subplot for each discovered task.
Using --tasks --separate generates one figure per task, with each supplied --plot shown as a subplot within that task's figure. Effectively equivalent to running --task <TASK> --plot ... for each discovered task.
Comparison Parameters
When multiple runs share the same algorithm name (e.g. from an ablation study) use --comparison-parameter to specify one or more distinguishing configuration paths.
cares-rl-plot \
--task <BENCHMARK_ROOT> \
--comparison-parameter alg_config.<PARAMETER_A> \
--comparison-parameter alg_config.<PARAMETER_B> \
--output ~/cares_rl_plots
Multiple Comparison Parameters
Use --comparison-parameter repeatedly to specify multiple distinguishing configuration paths. The order of the parameters determines the order of the values in the generated comparison label.
The comparison legend label for each run is generated as:
Legend Labels
Use --legend-label to override the legend label for each discovered comparison in the order they are discovered to make them tidier for publications.
Example:
cares-rl-plot \
--task ~/hpc_outputs/Ant/ \
--output ~/cares_rl_logs/figures/ \
--comparison-parameter alg_config.plasticity_config.replacement_enabled \
--comparison-parameter alg_config.actor_lr_params.weight_decay \
--comparison-parameter alg_config.actor_lr_params.betas \
--legend-label "tuned" \
--legend-label "ppo" \
--legend-label "L2" \
--legend-label "cbp + L2" \
--legend-label "cbp"
Legends
Single-panel figures place the legend inside the plotting axes.
Multi-panel and combined task-grid figures use one shared legend below the subplot grid. When a plot uses both primary and secondary y-axes, each axis receives a separate legend row identified by its metric or overridden axis label.
Use --legend-label to override the legend label for each discovered method in the order they are discovered or given.
cares-rl-plot \
--task <TASK_DIRECTORY> \
--legend-label "Method A" \
--legend-label "Method B" \
--output ~/cares_rl_plots
Plotting Order
List discovered comparisons without rendering to see what will be plotted in what order:
Layout Controls
Common formatting options:
--title--rows,--columns--figure-width: total figure width in inches--row-height: height allocated to each subplot row in inches--dpi--format(repeatable; defaultpng)--label-fontsize,--title-fontsize,--ticks-fontsize,--legend-fontsize(points)
Total figure height is:
The automatic defaults adapt to single-panel and multi-panel figures. Figure width remains fixed as columns are added, allowing multi-panel plots to fit within a publication-width figure.
Example:
cares-rl-plot \
--task <TASK_DIRECTORY> \
--title "HalfCheetah Comparison" \
--columns 2 \
--figure-width 6.8 \
--row-height 1.9 \
--format png \
--format pdf \
--dpi 300 \
--output ~/cares_rl_plots
Saved Figure Dimensions
Figure width and row height are passed to Matplotlib in inches. Raster resolution is determined by these dimensions and --dpi. Saved files use tight bounding-box cropping, so the final pixel dimensions may differ slightly from the nominal figure size.
Train-Series Processing
For train-series smoothing and alignment:
--train-window-size: centered rolling mean window applied independently to each training seed before aggregation. Default:20.--train-bin-size: optional fixed training-step bin width used to align seeds before aggregation. Binning is disabled by default.
Training curves are smoothed independently within each seed before cross-seed
aggregation. Evaluation curves are not smoothed. When --train-bin-size is
provided, training observations are assigned to fixed-width step bins within
each seed before the mean and standard deviation are calculated across seeds.
Display controls:
--plot-seeds--no-mean--no-std
Example:
Troubleshooting
- If no runs are discovered, verify each run directory contains numeric seed folders with
data/train.csvand/ordata/eval.csv. - If legend labels fail, ensure the number of
--legend-labelvalues exactly matches discovered comparisons. - If multiple runs share one algorithm name, add
--comparison-parameterso comparison labels become unique.
For complete option help, run:






