Skip to content

A Python package that leverages OpenAI's GPT API to create matplotlib graphs using natural language prompts. Simplify data visualization by generating detailed plots without needing to write any matplotlib code. Ideal for users who want powerful, AI-driven graphing with minimal effort.

License

Notifications You must be signed in to change notification settings

codingwithshawnyt/matplotlib-visualizer

Repository files navigation

matplotlib-visualizer

Are you looking to streamline your data visualization process with matplotlib? Enter matplotlib-visualizer - a cutting-edge tool designed to simplify graph generation through natural language commands. By leveraging OpenAI's GPT API, innovative prompt engineering techniques, and employing few-shot learning capabilities, matplotlib-visualizer eliminates the need for manual matplotlib coding.

Import matplotlib-visualizer via pip:

pip install pip install matplotlib-visualizer==1.0

Imagine we have a dataset data featuring four distinct curves labeled 'a', 'b', 'c', and 'd':

import numpy as np

data = {'a': [...],  # Specify the data for curve 'a'
        'b': [...],  # Specify the data for curve 'b'
        'c': [...],  # Specify the data for curve 'c'
        'd': [...]}  # Specify the data for curve 'd'

In a typical scenario where each curve needs to be plotted with specific styling and a customized title, conventional matplotlib code might look like this:

import matplotlib.pyplot as plt

plt.plot(data['a'], linestyle='dashed', label='a')
plt.plot(data['b'], label='b')
plt.plot(data['c'], label='c')
plt.plot(data['d'], label='d')

plt.title('Custom Graph Title')
plt.legend()
plt.show()

On the other hand, leveraging the intuitive functionality of matplotlib-visualizer, accomplishing the same task is simplified:

from matplotlib-visualizer.matplotlib-visualizer import matplotlib-visualizer

mpl_viz = matplotlib-visualizer("YOUR-OPENAI-API-KEY")
prompt = "Generate a graph for each curve in the dataset and title it 'Custom Graph Title'. Set curve 'a' as a dashed line."
generated_code = mpl_viz(prompt)

Inspect the code output through:

print(generated_code)  # Display the GPT-generated code

Continually evolving, this project aims to enhance and expand its capabilities over time. Thank you for considering matplotlib-visualizer for your data visualization endeavors.

About

A Python package that leverages OpenAI's GPT API to create matplotlib graphs using natural language prompts. Simplify data visualization by generating detailed plots without needing to write any matplotlib code. Ideal for users who want powerful, AI-driven graphing with minimal effort.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published