Practical overview
When it fits
Use it when working in Python with a pandas DataFrame and an OpenAI API key, and a natural-language request is a useful starting point for a Matplotlib chart.
Who it is for
- Python users who want to request Matplotlib charts in natural language from an existing pandas DataFrame.
- Notebook and script authors exploring data who can review generated Python code and manage what data is sent to OpenAI.
Documented uses
- Generate a chart from a DataFrame by describing the desired plot in a prompt.
- Add prompt-based plot generation to a Python script or notebook.
- Explore a dataset visually without writing all plotting code from scratch.
Requirements & limits
- Requires an OpenAI API key; the documented default model is gpt-3.5-turbo, with gpt-4 shown as an alternative.
- The first five DataFrame rows are sent to OpenAI, so consider sensitive data before use.
- The README warns that executing model-generated Python code is unsafe;
exec()is commented out by default in the described version. - The README characterizes the project as experimental and notes possible OpenAI token costs.
- The repository identifies the license as Apache-2.0.
Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.
Set up PlotAI for prompt-based plotting
Install the package, configure an OpenAI API key and prepare the documented DataFrame-and-prompt workflow.
Before you start
- Python environment
- pandas DataFrame
- OpenAI API key
Steps
Install the package with the command below.
pip install plotaiPut
OPENAI_API_KEY=your-key-herein a.envfile, or set the key in Python usingos.environ["OPENAI_API_KEY"].Import
PlotAIand initialize it with a pandas DataFrame:plot = PlotAI(df).Request a plot with
plot.make("make a scatter plot"). Check the repository's execution warning before enabling generated-code execution.
Expected outcome
A configured PlotAI object can receive a natural-language plotting request for a supplied DataFrame.
Guide limitations
- The described workflow uses OpenAI; the README says the first five DataFrame rows are sent to the service.
- Generated code execution is a security risk, and the described version has the
exec()call commented out by default. - The project is described as experimental; OpenAI token usage may incur costs.
Sources & review
Source record details
- Source availability
- Active
- Sources checked
- 16 November 2026
- Original website title
- mljar/plotai · Official homepage title · retained in its source language

