PlotAI - Your Ultimate Plotting Assistant! ππ€ Use ChatGPT-3.5 to create plots in Python and Matplotlib directly in your Python script or notebook.
π¨π€ Create Python plots in matplotlib with LLM π¨π€
π Get Started Β Β β’Β Β π€ Issues Β Β β’Β Β π¦ Twitter Β Β β’Β Β π©βπΌ LinkedIn
The easiest way to create plots in Python and Matplotlib. The plotai
is using LLM to generate code and plots.
The idea:
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.https://github.com/mljar/plotai/assets/6959032/cb80bc35-e534-466d-aa1d-ce240d35f624
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).
Install plotai
package:
pip install plotai
Create .env
file with the OpenAI API key:
OPENAI_API_KEY=your-key-here
You can also pass the OpenAI API key in Python:
import os
os.environ["OPENAI_API_KEY"] = "your-key-here"
Import plotai
and make plots:
# import PlotAI
from plotai import PlotAI
# create PlotAI object, pass pandas DataFrame as an argument
plot = PlotAI(df)
# make a plot, just tell what you want
plot.make("make a scatter plot")
https://github.com/mljar/plotai/assets/6959032/e62b1a26-7c91-40e4-9d2d-1a600d8dd7ba
Stay up-to-date with the latest updates about PlotAI π¨π€ by following us on Twitter (MLJAR Twitter) and LinkedIn (Aleksandra LinkedIn & Piotr LinkedIn). We look forward to connecting with you and hearing your thoughts, ideas, and experiences with PlotAI. Let's explore the future of AI together!
PlotAI is in very experimental form, below are some limitations:
PlotAI
.This project, PlotAI, is provided "as is" without any warranty, express or implied. By using this software, you agree to assume all risks associated with its use, including but not limited to data loss, system failure, or any other issues that may arise. The developers and contributors of this project do not accept any responsibility or liability for any losses, damages, or other consequences that may occur as a result of using this software.
Please note that the use of the OpenAI language models can be expensive due to its token usage. By utilizing this project, you acknowledge that you are responsible for monitoring and managing your own token usage and the associated costs. It is highly recommended to check your OpenAI API usage regularly and set up any necessary limits or alerts to prevent unexpected charges.