Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

How to Force PandasAI to Use Plotly Instead of Matplotlib for Visualizations#1818

Unanswered
muhammadhamzaazhar asked this question inQ&A
Discussion options

I've been experimenting with PandasAI and noticed that whenever I query to generate a plot (e.g., scatter, pie, bar), the logs show that it defaults to generating visualization code using Matplotlib behind the scenes.

For my use case, especially involving interactive dashboards with streamlit, I’d prefer the llm to generate Plotly code instead.

Is there a way to:

  • Explicitly configure PandasAI to use Plotly as the default visualization backend?
  • Guide the LLM to consistently generate Plotly code (e.g., via prompt engineering or system instructions)?

Any tips, config flags, or examples would be greatly appreciated.

You must be logged in to vote

Replies: 1 comment

Comment options

Hi! It does not work with LiteLLM (didn't investigate why - probably different use of custom prompt), but with OpenAI I use the following in the agent prompt.

"When plotting - use appropriate Plotly chart, write plot to image file and return path. Display the plot using Streamlit (import streamlit as st; st.plotly_chart) if returning chart response. Do not run .show() on figure. Use pio.write_image to save image to file."

You must be logged in to vote
0 replies
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Category
Q&A
Labels
None yet
2 participants
@muhammadhamzaazhar@grishasen

[8]ページ先頭

©2009-2025 Movatter.jp