Python chart code with matplotlib from your data

Get clean, labelled matplotlib chart code from a description of your data, with the right chart type, readable styling and export settings.

Published
Works with
ChatGPT, Claude and Gemini
Level
Intermediate
By
GoodAIPromt editorial team

Writing matplotlib code from memory means looking up the same settings for titles, axes, colours and figure size every time, and default charts rarely look good enough to share. This prompt turns a description of your data and the point you want to make into complete, commented matplotlib code with the right chart type, readable labels and export settings.

The prompt

Act as a data visualization engineer. Write Python code that makes a chart with matplotlib (and pandas for loading).

Data source: [E.G. CSV FILE "sales.csv" / A PANDAS DATAFRAME CALLED df]
Columns and types: 
Sample rows: 
The message the chart should show: 
Audience and where it will appear: 
Preferences: 

Do this:
1. Recommend the chart type for the message and say why in one sentence (and which type to avoid).
2. Write complete, runnable code: imports, loading, any cleaning or grouping needed, the chart, a clear title stating the takeaway, axis labels with units, readable tick formatting (thousands separators, dates), a legend only if needed, and direct labels where they help.
3. Save as PNG at 200 dpi and as SVG, with tight layout.
4. Comment each block briefly.
5. List 2 variations (e.g. highlight one series, small multiples) with the lines to change.

Use only columns I listed. If the data needs a step you're unsure about (like date formats), add a clear comment marked TODO.

0 of 5 blanks filled

How to use it

  1. Paste real column names and a few rows so the code runs without edits.
  2. Run it in a notebook first and adjust figure size for your slide or page.
  3. Keep the code as a reusable function for the next report.

Tips

  • A title that states the finding ("Q3 growth came from Region A") beats a label ("Revenue by month").
  • Highlight one series in colour and keep the rest grey to focus attention.

Frequently asked questions

What does this prompt do?

Get clean, labelled matplotlib chart code from a description of your data, with the right chart type, readable styling and export settings.

Which AI tools does it work with?

It is written for ChatGPT, Claude and Gemini. It also works in other AI tools that accept text prompts, with small changes.

What do I need to fill in?

5 blanks: column name – type – example value, one per line; paste 5–10 rows; e.g. "monthly revenue grew in q3 for region a only"; e.g. slide deck, report, dashboard image; e.g. colour-blind safe, brand colour #1f6feb, no gridlines. Click each blue blank on the page, type your details and press Copy prompt.

Is this prompt free to use?

Yes. You can copy and use it for personal and commercial work.

matplotlibpython chartsdata visualizationpandas

More prompts for ChatGPT, Claude, Gemini.