Visualization Tools¶
Tools for generating charts and visualizations.
Temporal Plots¶
generate_temporal_plot¶
Create time series charts.
generate_temporal_plot(
ctx: RunContext[None],
dataset_name: str,
date_column: str,
value_column: str,
plot_type: str = "line", # line, area, bar
filters: List[Dict] = None,
title: str = None
) -> str
Example:
Supported types:
| Type | Description |
|---|---|
line |
Line chart |
area |
Area chart |
bar |
Bar chart |
Flexible Plots¶
generate_flexible_plot¶
Create various chart types.
generate_flexible_plot(
ctx: RunContext[None],
dataset_name: str,
x_column: str,
y_column: str = None,
plot_type: str = "bar", # bar, pie, scatter, heatmap, distribution, bubble, stacked_bar
filters: List[Dict] = None,
title: str = None
) -> str
Example:
Supported types:
| Type | Description | Required Columns |
|---|---|---|
bar |
Bar chart | x, y |
pie |
Pie chart | x, y |
scatter |
Scatter plot | x, y |
heatmap |
Heatmap | x, y (as matrix) |
distribution |
Distribution plot (histogram/KDE) | x or x, y for grouped |
bubble |
Bubble chart | x, y, size |
stacked_bar |
Stacked bar chart | x, y, group |
Spatial Plots¶
generate_spatial_plot¶
Create choropleth maps.
generate_spatial_plot(
ctx: RunContext[None],
dataset_name: str,
location_column: str, # ID_MUNICIP, UF
value_column: str,
filters: List[Dict] = None,
title: str = None
) -> str
Example:
Supported location types:
| Type | Column | Description |
|---|---|---|
| Municipality | ID_MUNICIP | 7-digit IBGE code |
| State | UF | 2-letter state code |
Comparison Plots¶
generate_comparison_plot¶
Compare multiple datasets visually.
generate_comparison_plot(
ctx: RunContext[None],
dataset_names: List[str],
x_column: str,
y_column: str,
plot_type: str = "line",
title: str = None
) -> str
Example:
Raster Visualization¶
plot_raster_data¶
Visualize geospatial raster data (GeoTIFF) as a color-mapped image.
plot_raster_data(
ctx: RunContext[None],
file_path: str, # Path to raster file
band: int = 1, # Band index (1-indexed)
title: Optional[str] = None, # Plot title
cmap: str = "viridis", # Matplotlib colormap
vmin: Optional[float] = None, # Min value for color scale
vmax: Optional[float] = None, # Max value for color scale
extent: Optional[str] = None # Bounding box JSON [min_lon, min_lat, max_lon, max_lat]
) -> PlotResult
Example:
Supported colormaps: viridis, plasma, hot, coolwarm, YlOrRd, RdYlGn_r, and all matplotlib colormaps.
Cropping with extent:
Diagrams¶
generate_diagram¶
Create Mermaid diagrams (flowcharts, sequence diagrams, etc.).
generate_diagram(
ctx: RunContext[None],
diagram_type: str, # flowchart, sequence, class, state
content: str, # Diagram specification
title: str = None
) -> str
Example:
Supported types:
| Type | Description |
|---|---|
flowchart |
Process flow diagrams |
sequence |
Interaction/sequence diagrams |
class |
Class hierarchy diagrams |
state |
State machine diagrams |
Plot Discovery¶
list_available_plots¶
List all previously generated plots that are available for reference.
This tool is useful for referencing or including existing plots in reports.
Image Output¶
Plots are saved as WebP files and displayed inline in the chat:
Visualization Tips¶
Choosing Plot Types¶
| Data Type | Recommended Plot |
|---|---|
| Time series | Line or area |
| Categories | Bar or pie |
| Geographic | Choropleth map |
| Correlation | Scatter |
| Comparison | Multi-line or grouped bar |
Best Practices¶
- Always request visualizations: The agent works best when asked for charts
- Be specific about type: Specify line, bar, map, etc.
- Include filters: Narrow data for clearer charts
- Request titles: Ask for descriptive titles
Example Requests¶
Time series:
Geographic:
Comparison:
Distribution: