MultiFunctionPlotter (MFP)

Publication-quality plotting for data scientists, engineers, and AI agents

A lightweight, agent-friendly plotting DSL with 85% fewer tokens than matplotlib. Create stunning visualizations from CSV, TXT, or DAT files in seconds.

✨ Key Features

Ultra-Lightweight DSL

Gnuplot-style syntax. 85% fewer tokens than matplotlib. Perfect for AI agents.

Multi-Format Support

CSV, TXT, DAT, Excel, JSON. Automatic format detection.

30+ Plot Styles

Lines, markers, error bars, scatter, heatmaps, contours, distributions, and more.

Advanced Formatting

Scientific notation, custom ticks, date formatting, log scales, rotations.

Subplot Mosaics

Flexible multi-panel layouts with custom grid definitions.

Math Functions

Plot mathematical expressions with NumPy. Parameter control included.

Reproducibility

Save/replay configurations as JSON. Perfect for research.

Python API

Use as a library. Full programmatic control over plots.

🚀 Quick Start

Installation

pip3 install multifunctionplotter

Then run anywhere:

mfp --help

MCP Server (for AI Assistants)

pip3 install multifunctionplotter && mfp-mcp

Claude Code:
claude mcp add mfp -- mfp-mcp

opencode — find the path first:

which mfp-mcp

Then open ~/.config/opencode/opencode.json and add:

{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "mfp": {
      "type": "local",
      "command": [""]
    }
  }
}

Basic Line Plot

mfp data.csv using 1:2 with lines

With Title & Labels

mfp data.csv using 1:2 with lines title "Stock Prices" xlabel "Date" ylabel "Close"

Save to File

mfp data.csv using 1:2 with lines --save output.pdf

Custom Figure Size

mfp data.csv using 1:2 with lines --figsize 10:5

Multiple Series (Overlay)

mfp data.csv using 1:2 with lines, data.csv using 1:3 with dashed

Get Help

mfp --help
CLI vs Python Tool

The MFP CLI command and Python tools work slightly differently:

  • CLI parses labels but may not save them to plot.json for replay
  • Python tools (mfp_multi_plot, mfp_plot) handle complex plots more reliably
  • For subplots with specific labels, prefer Python tools or specify labels per-command

⚙️ Command Reference

Token Format Description Example
using / u X:Y Column indices (1-based for text, 0-based for CSV) using 1:2
with / w style Plot style (see Styles section) with lines
title "text" Plot title title "Stock Prices"
xlabel "text" X-axis label xlabel "Date"
ylabel "text" Y-axis label ylabel "Price"
legend / lg label Legend entry (no spaces) legend "Series A"
linewidth / lw int Line width in points (default: 2) linewidth 3
linecolor / lc color Color: tab:red, #3a7ab3, steelblue, etc. linecolor tab:blue
xrange min:max Force x-axis limits xrange 0:100
yrange min:max Force y-axis limits yrange 0:1000
bin int Histogram bin count (default: auto) bin 30
func: "expr" Math expression (requires xrange) func: "f(x) = np.sin(x)"
Flag Description Example
--xlog Set x-axis to logarithmic scale --xlog
--ylog Set y-axis to logarithmic scale --ylog
--save Save figure to file (format from extension) --save output.pdf
--subplot Create subplot mosaic layout --subplot AB-CD
--figsize Set figure size (width:height) --figsize 10:5
--help Display help documentation --help
--list-styles List all available plot styles --list-styles

Discrete Error Bars

Token Format Description
yerr <col> 1-based column index holding ±σ values
capsize int Cap width in points (default: 4)
mfp data.csv using 1:2 with errorbars yerr 3 capsize 5

Shaded Error Band

Same tokens as errorbars; capsize is ignored.

mfp data.csv using 1:2 with errorshade yerr 3

Scatter with Colormap

Token Format Description
cmap <col> 1-based column index for colour values (required)
colormap name Matplotlib colormap (default: viridis)
cbar_label "text" Colorbar label (optional)
mfp results.csv using 1:2 with scatter cmap 3 colormap plasma cbar_label "Temp (K)"

Popular Colormaps

Perceptually Uniform
  • viridis
  • plasma
  • inferno
  • magma
  • cividis
Diverging
  • coolwarm
  • RdBu
  • seismic
Sequential
  • Blues
  • Reds
  • YlOrRd
📌 Important: 2-D styles read the entire file as a numeric matrix (no header). Rows → y-axis, columns → x-axis. The using, xrange, and yrange tokens are ignored.
Style Description Example
heatmap 2D heatmap (imshow) — best for raster data with heatmap
contour Contour lines only with contour levels 15
contourf Filled contours with contourf levels 20

2D-Specific Tokens

  • colormap <name> — Colormap (default: viridis)
  • levels <int> — Number of contour levels (default: 10)
  • cbar_label "text" — Colorbar label

🎨 Plot Styles

Style Alias Description Example
lineslSolid linewith lines
dashedDashed linewith dashed
dottedDotted linewith dotted
pointspCircle markers onlywith points
linespointslpLine + circle markerswith linespoints
starsStar markerswith stars
dDiamond markerswith d
Style Description Example
histHistogram (seaborn histplot)with hist bin 30
kdeKernel Density Estimationwith kde
boxBox-and-whisker plotwith box
violinViolin plotwith violin
Style Description Requirements
errorbars / ebDiscrete error barsRequires yerr <col>
errorshade / esShaded ±σ bandRequires yerr <col>
scatterScatter with colormapRequires cmap <col>
heatmap2D heatmap2D matrix file
contourContour lines2D matrix file
contourfFilled contours2D matrix file

⚡ Advanced Features

Scientific Notation

mfp data.csv using 1:2 with lines sci_notation both

Options: x, y, or both

Custom Tick Positions

mfp angles.csv using 1:2 with points xticks "0,90,180,270"

Tick Rotation

mfp data.csv using 1:2 with lines xtick_rotation 45 ytick_rotation 90

Date Formatting

mfp timeseries.csv using 1:2 with lines date_format "%Y-%m-%d"

Format codes: %Y (year), %m (month), %d (day), %H (hour), %M (min), %S (sec)

Basic Function Plot

mfp func: "f(x) = np.sin(x)" xrange 0:10

Function with Parameters

mfp func: "f(x,a=2,b=0.5) = a*np.exp(-b*x)" xrange 0:10

Common Expressions

  • np.sin(x), np.cos(x), np.tan(x) — Trigonometric
  • np.exp(x), np.log(x), np.sqrt(x) — Exponential & Logarithmic
  • np.where(condition, true_val, false_val) — Conditional
  • np.linspace(start, stop, num) — Linear spacing

2×2 Grid Layout

mfp --subplot AB-CD data1.csv using 1:2 with lines, data2.csv using 1:2 with hist, data3.csv using 1:2 with kde, data4.csv using 1:2 with scatter cmap 3

Asymmetric Layout

mfp --subplot AA-BC top_spans_two, bottom_left, bottom_right
Layout Format:
  • Letters represent panels (A, B, C, ...)
  • Use - to separate rows
  • Each command separated by comma
Important: Subplot Labels
When using subplots, axis labels must be specified per-command:
mfp "cmd1 xlabel 'X' ylabel 'Y', cmd2 xlabel 'A' ylabel 'B'"
Global xlabel/ylabel may not apply to individual subplots.
Histogram Requirement
The hist style requires both x and y columns:
# CORRECT
mfp data.csv using 5:0 with hist bin 25

# WILL ERROR - missing y column
mfp data.csv using 5 with hist bin 25

Logarithmic X-Axis

mfp spectrum.csv using 1:2 with lines --xlog

Logarithmic Y-Axis

mfp spectrum.csv using 1:2 with lines --ylog

Both Axes Logarithmic

mfp spectrum.csv using 1:2 with lines --xlog --ylog

📝 Examples & Recipes

Basic Line Plot

mfp data.csv using 1:2 with lines lc tab:blue legend "Series A"

Multiple Series (Overlay)

mfp data.csv using 1:2 with lines lc green, data.csv using 1:3 with dashed lc red

Error Bars (Discrete)

mfp data.csv using 1:2 with errorbars yerr 3

Error Shaded Band

mfp data.csv using 1:2 with errorshade yerr 3 lc steelblue, data.csv using 1:2 with lines lc steelblue

Colormap Scatter

mfp results.csv using 1:2 with scatter cmap 3 colormap plasma

Heatmap

mfp matrix.dat with heatmap colormap viridis cbar_label "Intensity"

Filled Contour Plot

mfp matrix.dat with contourf levels 20 colormap RdBu

Log-Scale Spectrum

mfp spectrum.csv using 1:2 with lines --xlog --ylog

Histogram

mfp samples.csv using 0:1 with hist bin 30 lc tab:orange

Math Function

mfp func: "f(x,a=1) = a*np.sin(x)" xrange 0:10 lc tab:green

2×2 Subplot Grid

mfp --subplot AB-CD d1.csv using 1:2 with lines, d2.csv using 1:2 with hist, d3.csv using 1:2 with kde, d4.csv using 1:2 with scatter cmap 3

Publication-Quality PDF

mfp data.csv using 1:2 with lines title "Results" xlabel "Time" ylabel "Value" sci_notation y --save figure.pdf

Replay Session

mfp plot.json

MFP saves last plot config to plot.json

🔧 Data Manipulator (DM)

Interactive CLI tool for exploring, cleaning, and transforming tabular data without writing code.

Quick Start

mfp DM

Launches interactive data manipulation REPL.

Supported Formats

.csv — Comma-separated values
.xlsx / .xls — Excel workbooks
.json — JSON arrays

Commands Reference

Inspection

showPrint current DataFrame
head [N]First N rows (default 10)
tail [N]Last N rows (default 10)
properties / propsColumn dtypes, NaN counts, stats
counts <col>Frequency of unique values

Filtering & Sorting

filter <expr>Pandas query expression
slice start:endKeep rows [start, end)
sort <col> asc|descSort by column

Transformation

rename old:new,...Rename columns
cast <col> typeChange dtype (int/float/str)
addcol <name> exprAdd column from expression
modify <col> old newReplace values
delete <col>Drop column or row

Data Cleaning

dedup [col1,col2]Remove duplicate rows
fillna <col> valueFill NaN cells
dropna <col>Drop rows with NaN

I/O

load <file>Load new file
save <file>Save to file
append <file>Append rows from file
merge <file> colMerge on column
generate exprGenerate data from expression

History

undoRevert last operation
redoRe-apply undone operation

Example Workflow

Action> load data.csv
Action> head
Action> properties
Action> filter price > 100
Action> sort volume desc
Action> rename old_name:new_name
Action> addcol profit revenue - cost
Action> dedup
Action> save cleaned_data.csv

Tips