Matplotlib chart component plugin for expops
Project description
expops_matplotlib
Matplotlib chart component plugin for expops.
Install
pip install expops-matplotlib
This installs expops and registers the matplotlib component runner via entry points.
Usage
Matplotlib component processes must declare probe_paths (same model as static reporting charts). Series data is read from the run KV store via those paths; you cannot supply x / y from pipeline edges or input_transform.
Use shorthand probe params for chart definitions (step-keyed dicts: "1": value, …):
- Line/Histogram/BoxPlot/HeatMap:
parameters.probe_metric(+ optionalparameters.probe_key). This can be omitted ifprobe_paths.<probe_key>.metricis provided. - ScatterPlot:
parameters.probe_x_metric+parameters.probe_y_metric(+ optionalparameters.probe_key). This can be omitted ifprobe_paths.<probe_key>.x_metric/probe_paths.<probe_key>.y_metricare provided.
For bar charts, prefer parameters.probe_bar_metric and/or per-probe probe_paths.<key>.metric.
Supported curated charts:
matplotlib.BarChart.render—parameters.probe_bar_metricand/or per-probeprobe_paths.<key>.metricmatplotlib.LineChart.render—parameters.probe_metric(+ optionalparameters.probe_key)matplotlib.ScatterPlot.render—parameters.probe_x_metric+parameters.probe_y_metric(+ optionalparameters.probe_key)matplotlib.Histogram.render—parameters.probe_metric(+ optionalparameters.probe_key)matplotlib.BoxPlot.render—parameters.probe_metric(+ optionalparameters.probe_key, one box)matplotlib.HeatMap.render—parameters.probe_metric(+ optionalparameters.probe_key)
output_mapping may still remap canonical outputs (chart_path, chart_name).
Probe Paths and Metric Formats
probe_paths
probe_paths is a required mapping from a short probe key (for example train, eval, mlp_train) to a selector string that identifies a process run (the same kind of selector used by static reporting charts).
For some charts, probe_paths.<key> can also be an object instead of a plain string. In that case, the runner still reads the KV metrics from the path field, but it can also use the extra override fields described below.
Example shape:
probe_paths:
train:
path: "//*[@name='train_model']"
metric: loss # chart-specific override (see below)
x_metric: step_time # scatter-specific override (see below)
y_metric: loss # scatter-specific override (see below)
label: Train Loss # BarChart-specific label override
Step-keyed series
Most series-based charts (Line/Scatter/Histogram/BoxPlot) read metric values from the run KV store using the selected metric name.
For these charts, each metric is expected to be a step-keyed dict in the form:
{
"1": 0.42,
"2": 0.41,
"3": 0.40
}
The runner converts step keys to int and values to float. Missing steps simply do not appear in the chart data.
HeatMap matrix
For HeatMap, the selected metric must be a 2D nested list (matrix) of numbers (passed to matplotlib.axes.Axes.imshow).
[[1, 2], [3, 4]]
Precedence summary (shorthand + probe-path overrides)
All curated charts use shorthand params. For non-bar charts:
probe_metric(+ optionalprobe_key)probe_x_metric/probe_y_metric(+ optionalprobe_key)
Per-probe overrides in probe_paths.<key> take precedence over the shorthand values.
Defaults (all matplotlib chart processes)
If omitted, the runner sets:
filename— derived from the processname(seed/part suffixes stripped), sanitized to a safe basename, with a.pngextension (e.g.plot_metrics→plot_metrics.png).title— the same base process name with underscores replaced by spaces (e.g.plot_metrics→plot metrics).ylabel(BarChart only) — ifparameters.ylabelis empty, usesprobe_bar_metric(or a single shared per-probe metric when metrics differ).
Override any of these by setting the corresponding parameters key explicitly.
Bar chart (categorical bars, last value per probe)
The runner creates one bar per probe_paths entry, in YAML/map order.
Simple form (same metric for all probes):
processes:
- name: "accuracy_bars"
component: "matplotlib.BarChart.render"
probe_paths:
train: "//*[@name='train_model']"
eval: "//*[@name='predict_model']"
parameters:
grid: true
ylim: [0, 1]
probe_bar_metric: accuracy
Optional per-probe metrics (metric can live next to the path):
processes:
- name: "mixed_metrics_bars"
component: "matplotlib.BarChart.render"
probe_paths:
train:
path: "//*[@name='train_model']"
metric: accuracy
eval:
path: "//*[@name='predict_model']"
metric: loss
For each bar entry, the runner takes the last value of the selected metric over logged steps from each probe key in probe_paths (metric comes from probe_bar_metric or per-probe probe_paths.<key>.metric).
More details:
- Bar order follows the YAML/map order of
probe_paths. - Bar labels come from the
probe_pathskey by default, orprobe_paths.<key>.labelwhen set. - Metric selection comes from:
parameters.probe_bar_metric(shared metric for all probes),probe_paths.<key>.metric(per-probe metric).
Matplotlib parameters forwarded by the adapter for BarChart: color, alpha, width. Axis labels come from xlabel/ylabel (or defaults set by the chart spec), and grid/ylim are handled by the runner.
Line chart (one metric vs step index)
processes:
- name: "loss_line"
component: "matplotlib.LineChart.render"
probe_paths:
train: "//*[@name='train_model']"
parameters:
probe_key: train
probe_metric: loss # can be omitted if probe_paths.<probe_key>.metric is provided
Optional per-probe override: set probe_paths.<key>.metric; it takes precedence over parameters.probe_metric.
Data contract:
parameters.probe_metricselects a KV metric name inside the probed block namedparameters.probe_key.- The metric must be a step-keyed dict. The chart x-values are the integer step keys (sorted), and the y-values are the corresponding floats.
Matplotlib parameters forwarded by the adapter for LineChart: color, alpha, linewidth, linestyle, marker.
Example using shorthand with per-probe metric overrides:
processes:
- name: "loss_line_shorthand_overrides"
component: "matplotlib.LineChart.render"
probe_paths:
train:
path: "//*[@name='train_model']"
metric: train_loss
val:
path: "//*[@name='predict_model']"
metric: val_loss
parameters:
probe_key: val
probe_metric: val_loss # optional (override already set on probe_paths.val.metric)
grid: true
color: "steelblue"
Scatter (two metrics on the same probe, aligned by step keys)
parameters:
probe_key: train # optional; defaults to the first key in `probe_paths`
probe_x_metric: step_time # can be omitted if probe_paths.<probe_key>.x_metric is provided
probe_y_metric: loss # can be omitted if probe_paths.<probe_key>.y_metric is provided
Optional per-probe override: set probe_paths.<key>.x_metric / probe_paths.<key>.y_metric; it takes precedence over parameters.probe_x_metric / parameters.probe_y_metric.
Data contract:
probe_x_metric/probe_y_metricselect two step-keyed KV metrics from the same probe block.- The runner aligns the two series by taking the intersection of step keys present in both x and y dicts.
- The chart x-values are floats from the x-metric at the shared steps; y-values come from the y-metric at those same steps.
Matplotlib parameters forwarded by the adapter for ScatterPlot: color, alpha, marker, s.
Example using shorthand with per-probe x_metric / y_metric overrides:
processes:
- name: "pred_vs_time_scatter"
component: "matplotlib.ScatterPlot.render"
probe_paths:
train:
path: "//*[@name='train_model']"
x_metric: step_time
y_metric: loss
parameters:
probe_key: train
probe_x_metric: step_time # optional (override already set)
probe_y_metric: loss # optional (override already set)
marker: "o"
s: 10
Histogram (values = y-series of one step-keyed metric)
parameters:
probe_key: train # optional; defaults to the first key in `probe_paths`
probe_metric: score # can be omitted if probe_paths.<probe_key>.metric is provided
Optional per-probe override: set probe_paths.<key>.metric; it takes precedence over parameters.probe_metric.
Data contract:
probe_metricselects a step-keyed KV metric.- The runner converts that step-keyed metric to a list of y-values; step keys themselves are not used for binning.
bins(if provided) is forwarded toax.hist(...)via the adapter.
Matplotlib parameters forwarded by the adapter for Histogram: bins, color, alpha.
Example:
processes:
- name: "loss_hist"
component: "matplotlib.Histogram.render"
probe_paths:
train: "//*[@name='train_model']"
parameters:
probe_metric: train_loss
probe_key: train
bins: 20
color: "steelblue"
alpha: 0.7
grid: true
Box plot (one list of values per probe key)
parameters:
probe_key: train # optional; defaults to the first key in `probe_paths`
probe_metric: loss # can be omitted if probe_paths.<probe_key>.metric is provided
Data contract:
probe_metricselects a step-keyed KV metric from the selected probe key.- The runner extracts y-values from that metric’s step-keyed dict and passes a single data series to
ax.boxplot(...).
Matplotlib parameters forwarded by the adapter for BoxPlot: vert, patch_artist.
Heat map (metric value is a nested list matrix)
parameters:
probe_key: train # optional; defaults to the first key in `probe_paths`
probe_metric: confusion_matrix # can be omitted if probe_paths.<probe_key>.metric is provided
Optional per-probe override: set probe_paths.<key>.metric; it takes precedence over parameters.probe_metric.
Data contract:
probe_metricselects a matrix-valued KV metric.- The matrix must be a 2D nested list (rows x columns). Values are converted to
float. - The runner passes the matrix to
ax.imshow(...);cmap/aspect/interpolationare forwarded toimshow.
Matplotlib parameters forwarded by the adapter for HeatMap: cmap, aspect, interpolation.
Example:
processes:
- name: "confusion_heatmap"
component: "matplotlib.HeatMap.render"
probe_paths:
val: "//*[@name='predict_model']"
parameters:
probe_key: val
probe_metric: confusion_matrix
cmap: "Blues"
aspect: "auto"
interpolation: "nearest"
grid: true
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file expops_matplotlib-0.1.2.dev0.tar.gz.
File metadata
- Download URL: expops_matplotlib-0.1.2.dev0.tar.gz
- Upload date:
- Size: 21.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4a3272a022d6e6863ea878445f6eb3e064498c3a40d99c372346258f04b06e26
|
|
| MD5 |
e7bae18c36385e6ad5c53e13004d3985
|
|
| BLAKE2b-256 |
866779b40303209ac1c9ead52db85eb37a752626401ef0b7d5eeccdbc1596cfc
|
Provenance
The following attestation bundles were made for expops_matplotlib-0.1.2.dev0.tar.gz:
Publisher:
release.yml on local-minima-lab/expops-matplotlib
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
expops_matplotlib-0.1.2.dev0.tar.gz -
Subject digest:
4a3272a022d6e6863ea878445f6eb3e064498c3a40d99c372346258f04b06e26 - Sigstore transparency entry: 1142516837
- Sigstore integration time:
-
Permalink:
local-minima-lab/expops-matplotlib@62f2b535d45b5bd9177aa21ad3d1256a703f8a07 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/local-minima-lab
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@62f2b535d45b5bd9177aa21ad3d1256a703f8a07 -
Trigger Event:
push
-
Statement type:
File details
Details for the file expops_matplotlib-0.1.2.dev0-py3-none-any.whl.
File metadata
- Download URL: expops_matplotlib-0.1.2.dev0-py3-none-any.whl
- Upload date:
- Size: 16.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cc634a1056624319fb208610a2207b213c0319639dd6c1afd0cf70d2f2e0b621
|
|
| MD5 |
3fa0453631dc5be00f79749a92a7c4d7
|
|
| BLAKE2b-256 |
7ce3b29742d75f8c4b9ba22a05ec653c0c7d4db8300280c4e7741fd7c3b63813
|
Provenance
The following attestation bundles were made for expops_matplotlib-0.1.2.dev0-py3-none-any.whl:
Publisher:
release.yml on local-minima-lab/expops-matplotlib
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
expops_matplotlib-0.1.2.dev0-py3-none-any.whl -
Subject digest:
cc634a1056624319fb208610a2207b213c0319639dd6c1afd0cf70d2f2e0b621 - Sigstore transparency entry: 1142516957
- Sigstore integration time:
-
Permalink:
local-minima-lab/expops-matplotlib@62f2b535d45b5bd9177aa21ad3d1256a703f8a07 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/local-minima-lab
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@62f2b535d45b5bd9177aa21ad3d1256a703f8a07 -
Trigger Event:
push
-
Statement type: