fabricatio-plot
Data visualization, synthetic data generation, and dataframe manipulation for the Fabricatio LLM agent framework.
Installation
pip install fabricatio[plot]
# or
uv pip install fabricatio[plot]
For optional file-format support:
pip install fabricatio[plot,excel] # Excel I/O
pip install fabricatio[plot,parquet] # Parquet I/O
Install with all Fabricatio components:
pip install fabricatio[full]
Overview
fabricatio-plot equips LLM agents with tools for matplotlib-based charting, programmatic synthetic data generation, dataframe CRUD operations, and file I/O. Toolboxes expose fine-grained functions agents can call; capabilities wrap them into higher-level LLM-driven workflows.
Key Components
Toolboxes
Low-level tools grouped by domain, exposed to agents via fabricatio-tool's ToolBox.
PlottingToolBox — matplotlib chart construction
| Function | Description |
|---|---|
create_figure(figsize, dpi) |
Create a new matplotlib Figure |
create_subplots(nrows, ncols, figsize) |
Create a figure with a grid of subplots |
plot_line(ax, x, y, ...) |
Draw a line chart on given axes |
plot_bar(ax, categories, values, ...) |
Draw a vertical bar chart |
plot_scatter(ax, x, y, ...) |
Draw a scatter plot |
set_labels(ax, title, xlabel, ylabel) |
Set title and axis labels |
set_legend(ax, location, fontsize) |
Add a legend to the chart |
configure_grid(ax, visible, linestyle, alpha) |
Configure grid lines |
save_plot(fig, save_path, dpi, transparent) |
Save figure to file |
DataSynToolbox — synthetic column generation
| Function | Description |
|---|---|
numeric_column(n_rows, low, high) |
Uniform-distribution numeric column |
normal_column(n_rows, mean, std) |
Normally distributed numeric column |
categorical_column(n_rows, categories) |
Random categorical column |
datetime_column(n_rows, start, end) |
Random datetime column in a range |
text_column(n_rows, prefix) |
Sequential text column (item_0, item_1, …) |
correlated_column(base_series, correlation) |
Column correlated with an existing series |
inject_missing(series, rate) |
Inject NaN values at a given rate |
DataCrudToolbox — dataframe create/read/update/delete
| Function | Description |
|---|---|
create_empty_dataframe(columns, dtypes) |
Create an empty DataFrame with typed columns |
add_computed_column(df, new_column, expression) |
Add a column via pandas expression |
get_row_by_index(df, index_value) |
Retrieve a single row by index |
fill_missing_values(df, column, strategy) |
Fill NaN with mean, median, mode, or constant |
transform_column(df, column, transformation) |
Apply log, sqrt, square, or normalize |
drop_columns(df, columns) |
Remove specified columns |
drop_rows_by_condition(df, condition) |
Remove rows matching a query condition |
rename_column(df, old_name, new_name) |
Rename a single column |
set_index_from_column(df, column, drop) |
Set the DataFrame index from a column |
DataIoToolBox — file-based I/O
| Function | Description |
|---|---|
load_csv(file_path) |
Read CSV into DataFrame |
load_excel(file_path, sheet_name) |
Read Excel into DataFrame (requires excel extra) |
load_parquet(file_path) |
Read Parquet into DataFrame (requires parquet extra) |
save_data(df, file_path, fmt) |
Save DataFrame as CSV, Excel, or Parquet |
Capabilities
Higher-level abstractions that orchestrate toolboxes with LLM reasoning.
Plot— aggregatesPlottingToolBox,DataCrudToolbox, andDataIoToolBox. Theplot(requirement, data, output_spec)method accepts a natural-language requirement and delegates to its toolboxes to produce charts.SynthesizeData— uses LLM to generate structured data from a natural-language description.generate_header()produces column names;generate_csv_data()returns a DataFrame;synthesize_data()handles large datasets by batching parallel generation.
Actions
Concrete fabricatio-core Action implementations ready to wire into task pipelines.
MakeCharts— takes a plot requirement (or the task's assembled prompt) and produces a chart, optionally saving to a specified path.MakeSynthesizedData— synthesizes a DataFrame from the task prompt and stores it under the keysynthesized_data.SaveDataCSV— saves a DataFrame to a path (given explicitly or determined by the LLM from the task context).
Usage
Toolboxes are stateless and can be called directly:
from fabricatio_plot.toolboxes.plot import create_figure, plot_line, set_labels, save_plot
fig = create_figure(figsize=(10, 4))
ax = fig.subplots()
plot_line(ax, x=[1, 2, 3], y=[4, 5, 6], label="Series A")
set_labels(ax, title="Sample Chart", xlabel="X", ylabel="Y")
save_plot(fig, "output.png")
Capabilities drive LLM-orchestrated workflows:
from fabricatio_plot.capabilities.plot import Plot
handler = Plot()
result = await handler.plot("Create a bar chart of monthly sales from the CSV at data/sales.csv")
Actions plug into Fabricatio task graphs:
from fabricatio_plot.actions.plot import MakeCharts
action = MakeCharts(plot_requirement="Scatter plot of x vs y", chart_save_path="scatter.png")
await action.execute(task)
Dependencies
fabricatio-core— core interfaces, configuration, and task modelfabricatio-tool—ToolBoxandHandleabstractionsmatplotlib— chart renderingnumpy— array operationspandas— DataFrame manipulation- Optional:
openpyxl(Excel I/O),pyarrow(Parquet I/O)
Configuration
All options below are read through the fabricatio configuration chain (see the
Configuration Guide). Set them under the
[ext.plot] table in fabricatio.toml, equivalently under
[tool.fabricatio.ext.plot] in pyproject.toml, or via
FABRICATIO_EXT__PLOT__<FIELD_UPPER> environment variables.
[ext.plot]
| Option | Type | Default | Description |
|---|---|---|---|
generate_header_template |
str |
"built-in/generate_header" |
Template for generating header. |
generate_csv_data_template |
str |
"built-in/generate_csv_data" |
Template for generating CSV data. |
csv_sep |
str |
"," |
Separator for CSV files. |
csv_codeblock_lang |
str |
"csv" |
Language for CSV code blocks. |
Access at runtime: from fabricatio_plot.config import plot_config.
License
MIT — see LICENSE
Metadata
Release files for fabricatio-plot 0.1.15
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| fabricatio_plot-0.1.15-py3-none-any.whl | Python 3 | none | any | Details |
Release files / fabricatio_plot-0.1.15-py3-none-any.whl
| Download URL | fabricatio_plot-0.1.15-py3-none-any.whl |
|---|---|
| Size | 28.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
39aba36072def820f33cf6e537d6cb4125b350329ce5215bc7c524f5c0cb2ae0
|
|
BLAKE2b-256 checksum How to use checksums |
e68206edec7708c47758d0672eaf00378a89e81c2dcc9a8456ab92c8b4854825
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|