Skip to main content

An AI-powered data visualization assistant using Plotly

Project description

Plot Agent

Tests PyPI version

An AI-powered data visualization assistant that helps users create Plotly visualizations in Python.

Installation

You can install the package using pip:

pip install plot-agent

Usage

See more examples in /examples/ (via nbviewer so that can see the charts easily).

Here's a simple minimal example of how to use Plot Agent:

import pandas as pd
from plot_agent.agent import PlotlyAgent

# ensure OPENAI_API_KEY is set and available for langchain

# Create a sample dataframe
df = pd.DataFrame({
    'x': [1, 2, 3, 4, 5],
    'y': [10, 20, 30, 40, 50]
})

# Initialize the agent
agent = PlotlyAgent()

# Set the dataframe
agent.set_df(df)

# Process a visualization request
response = agent.process_message("Create a line plot of x vs y")

# Print generated code
print(agent.generated_code)

# Get fig
fig = agent.get_figure()
fig.show()

agent.generated_code:

import pandas as pd
import plotly.graph_objects as go

# Creating a line plot of x vs y
# Create a figure object
fig = go.Figure()

# Add a line trace to the figure
fig.add_trace(
    go.Scatter(
        x=df['x'],  # The x values
        y=df['y'],  # The y values
        mode='lines+markers',  # Display both lines and markers
        name='Line Plot',  # Name of the trace
        line=dict(color='blue', width=2)  # Specify line color and width
    )
)

# Adding titles and labels
fig.update_layout(
    title='Line Plot of x vs y',  # Plot title
    xaxis_title='x',  # x-axis label
    yaxis_title='y',  # y-axis label
    template='plotly_white'  # A clean layout
)

Features

  • AI-powered visualization generation
  • Support for various Plotly chart types
  • Automatic data preprocessing
  • Interactive visualization capabilities
  • Integration with LangChain for advanced AI capabilities

Requirements

  • Python 3.8 or higher
  • Dependencies are automatically installed with the package

License

This project is licensed under the MIT License - see the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

plot_agent-0.2.2.tar.gz (10.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

plot_agent-0.2.2-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

Details for the file plot_agent-0.2.2.tar.gz.

File metadata

  • Download URL: plot_agent-0.2.2.tar.gz
  • Upload date:
  • Size: 10.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.6

File hashes

Hashes for plot_agent-0.2.2.tar.gz
Algorithm Hash digest
SHA256 d0968c4bb757ad544a7a0317f62faf766e2a010220807b0a51faaf4bef4c9ac8
MD5 2df78c786ad443556f214ab99819f2a2
BLAKE2b-256 76632d6cd3a37b6a414683e5068d8bf7a027fd8fd66792b9fd760f13ac00247e

See more details on using hashes here.

File details

Details for the file plot_agent-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: plot_agent-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 8.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.6

File hashes

Hashes for plot_agent-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5dbd27ae3248db85a7ab44d4012a327f54059bc40b903f4e9301b7fd4a7fe7f8
MD5 3c1991e5c0f67a8371899e1319dd63d7
BLAKE2b-256 82f89f07db7cbc01f40a159503fd6b2347d0229af28de9136aefaa4d8cc63b99

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page