The easiest way to create plots in Python and Matplotlib. The plotai is using LLM to generate code and plots.
The idea:
1. User provides input DataFrame and prompt.
2. The PlotAI constructs a prompt for LLM, which contains the first 5 rows of DataFrame and the user's prompt and asks for Python code as output.
3. Returned Python code is executed, and the plot is displayed.
The simplest possible API for plotting:
# import packages
import pandas as pd
from plotai import PlotAI
# create some data
df = pd.DataFrame({"x":[1,2,3], "y": [4,5,6]})
# do a plot
plot = PlotAI(df)
plot.make("scatter plot")
The PlotAI class has only one method, make().It works in Python scripts and in notebooks (Jupyter, Colab, VS Code).