Quickly generate plots in Python by simply describing them through text. For example, simply use the prompt "create a scatter plot with name labels" instead of endlessly searching the docs and stackoverflow. Given such a prompt, the autoplotlib Python library uses the OpenAI API to automatically generate the corresponding code and plot - saving you time and effort.
Warning This package is experimental. The package can execute code output from language models. Albeit unlikely, always check and confirm no malicious code was generated by the model before execution. Use at your own risk.
Installation
- Install the Python package:
pip install autoplotlib - Get an OpenAI API key by signing up here if you don't have one already.
Usage
The following is an example of plotting a pandas dataframe using the autoplotlib library. The plot() function takes a prompt describing the plot and the data to plot. The function returns the plot, the generated code, and the full response from the OpenAI API.
# set the OpenAI API key
import os
os.environ["OPENAI_API_KEY"] = "<YOUR_API_KEY>"
import autoplotlib as aplt
import pandas as pd
data = pd.DataFrame(
[[29, 177], [33, 186], [48, 161], [53, 173], [67, 152]],
index=["Alice", "Bob", "Charlie", "Dave", "Eve"],
columns=["age", "height"],
)
figure_description = """
Plot the data as scatterplot between height and age.
Add the names as labels next to the data points.
Ensure the labels don't overlap.
Mark people taller than 170 with a star instead of a point.
"""
code, fig, llm_response = aplt.plot(figure_description, data=data)
Contributing
See the development guide for information about contributing.
Potential future features
- Add sandboxing of code execution (see here)
License
Metadata
Release files for autoplotlib 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| autoplotlib-0.1.1.tar.gz | 1.3 MB | Without provenance | Details for autoplotlib-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| autoplotlib-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for autoplotlib-0.1.1-py3-none-any.whl |
Total release size: 1.3 MB
Release files / autoplotlib-0.1.1.tar.gz
| Download URL | autoplotlib-0.1.1.tar.gz |
|---|---|
| Size | 1.3 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5f8f5bdf9eec2c63c6427cfbb4d54952de4e185755780a0fba1ffdecd9c5c579
|
|
BLAKE2b-256 checksum How to use checksums |
5859f3b9d6ae699b9b5777d97431350ceba336796b5e32870d58add050ec1045
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.11.3
|
Release files / autoplotlib-0.1.1-py3-none-any.whl
| Download URL | autoplotlib-0.1.1-py3-none-any.whl |
|---|---|
| Size | 5.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
67d300b33703a3b89414b5944920668eee834706d8f3cbc76113b602ed5d7671
|
|
BLAKE2b-256 checksum How to use checksums |
43e69db1253f057dc11cf3a3211e54aca57053d58d66d03176fdcb8e20b2d4eb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.11.3
|
Security for autoplotlib 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.