How to Make a Chart with ChatGPT

Cody Schneider7 min read

While ChatGPT is known for its ability to write text, it can also be a surprisingly fast way to create charts and visualize data, especially if you know the right prompts. This guide will walk you through the most effective methods for making charts with ChatGPT, from directly generating them in the interface to producing code for more advanced visualizations.

GraphedGraphed

Still Building Reports Manually?

Watch how growth teams are getting answers in seconds — not days.

Watch Graphed demo video

Why Use ChatGPT for Data Visualization?

Using a general-purpose AI like ChatGPT for creating charts might not seem intuitive when tools like Excel or Google Sheets exist. However, the advantage lies in its conversational nature. Instead of clicking through menus to find the right settings, you can simply describe the chart you want in plain English. This makes it incredibly useful for:

  • Quick Analysis: Got a small dataset in a CSV? You can upload it and get a basic visualization in seconds to spot trends or outliers.
  • Speed and Efficiency: For simple charts, telling an AI what to build is often faster than creating it manually, especially if you're not a spreadsheet wizard.
  • Code Generation: If you're a developer or analyst, you can use ChatGPT to instantly generate the code for a specific chart using libraries like Matplotlib (Python) or Chart.js (JavaScript), saving you from looking up syntax.

Still, it's important to remember that ChatGPT is not a specialized business intelligence tool. Be mindful of its limitations, such as potential data misinterpretations, privacy concerns with sensitive data, and the fact that it produces static image files, not interactive, live-updating dashboards.

Method 1: Create a Chart Directly in an Instant

The simplest way to make a chart is by using ChatGPT’s built-in “Advanced Data Analysis” feature (formerly known as Code Interpreter), which is available to ChatGPT Plus subscribers. This feature allows you to upload files directly and ask ChatGPT to analyze and visualize them.

GraphedGraphed

Still Building Reports Manually?

Watch how growth teams are getting answers in seconds — not days.

Watch Graphed demo video

Step-by-Step Guide to Direct Chart Creation

Let's use a common marketing scenario: you have a CSV file with monthly marketing spend and the revenue it generated, and you want to visualize the relationship between them.

Step 1: Get Your Data Ready

Make sure your data is clean and organized in a simple format like a CSV or Excel file. Keep the column headers clear and descriptive. For our example, the CSV file, named marketing-performance.csv, looks like this:

Month,Marketing Spend,Revenue
January,5000,22000
February,5500,24500
March,6200,28000
April,5800,26500
May,7000,31000
June,7500,33500

Step 2: Upload Your File to ChatGPT

In a new chat, make sure you have the GPT-4 model with “Advanced Data Analysis” selected. Click the paperclip icon in the message box and upload your CSV file.

Step 3: Write a Clear and Specific Prompt

A good prompt is the key to getting a good chart. Be as specific as possible about the data you want to use, the type of chart you want, and any labels you need.

A good, simple prompt:

“Using the attached file, create a bar chart showing the Revenue for each Month.”

A more detailed prompt for a better chart:

“With the data from marketing-performance.csv, generate a line chart to show the trend of both 'Marketing Spend' and 'Revenue' over time. Place the 'Month' on the X-axis. Ensure the lines for Spend and Revenue are different colors and include a legend.”

Step 4: Review and Refine the Chart

ChatGPT will process your request and generate a Python script behind the scenes to create the chart. It will then display the final result as an image. This image is static, meaning you can't hover over it to see data points. But you can easily ask for changes.

If you don't like the initial chart, just ask for a revision with a follow-up prompt. Here are a few examples of refinement prompts:

  • "Can you change this to a stacked bar chart instead?"
  • "Add a title to the chart called 'Monthly Marketing Performance'."
  • "Change the color of the 'Revenue' line to a shade of green."
  • "Add data labels to the top of each bar to show the exact revenue amount."
GraphedGraphed

Still Building Reports Manually?

Watch how growth teams are getting answers in seconds — not days.

Watch Graphed demo video

Method 2: Generate Chart Code for More Control

If you need more than a static image - for instance, an interactive chart for a website or a visualization for a data analysis script - you can ask ChatGPT to write the code for you. This gives you complete control over the final output.

Step-by-Step Guide to Generating Code

Step 1: Describe Your Data and What You Need

You don't even need to upload your data for this method. You can just describe the structure of your data and the type of chart you need.

Example prompt for Python code (Matplotlib):

“I have a Pandas DataFrame with three columns: 'Date', 'New Users', and 'Active Users'. Write me the Python code using Matplotlib to create a line chart that plots both 'New Users' and 'Active Users' against the 'Date'. Make sure to add a title, label the axes, and include a legend.”

ChatGPT will provide a complete, commented code snippet that you can copy and paste directly into your programming environment (like a Jupyter notebook or a Python script).

Step 2: Use a Lightweight Syntax Like Mermaid

For simple diagrams and charts destined for markdown files (like in GitHub readmes or Notion pages), ask for Mermaid syntax. It's a text-based tool that renders diagrams from code.

Example prompt for Mermaid syntax:

“Generate the Mermaid syntax for a pie chart that shows website traffic sources: 58% from Organic Search, 22% from Paid Social, 15% from Direct, and 5% from Referral.”

ChatGPT will give you a code block like this:

pie title Website Traffic Sources
    "Organic Search" : 58
    "Paid Social" : 22
    "Direct" : 15
    "Referral" : 5

When this code is placed in a markdown editor that supports Mermaid, it renders a clean, visually appealing pie chart.

GraphedGraphed

Still Building Reports Manually?

Watch how growth teams are getting answers in seconds — not days.

Watch Graphed demo video

Best Practices for Prompting

Whether you're creating a chart directly or generating code, the quality of your output depends almost entirely on the quality of your prompt. Here are four tips for success:

  1. Be Hyper-Specific: Avoid vague requests like "show me my data." Instead, specify the chart type (bar, line, pie, etc.), the exact data to plot on the X and Y axes, and any desired customization like colors, titles, or labels.
  2. Provide Context: Briefly explain what the data means. For example, “This data shows weekly user signups for my SaaS app.” This context helps the AI choose better visual encodings and labels.
  3. Iterate on Your Request: Don't try to get everything perfect in one massive prompt. Start with a basic chart and then refine it with follow-up requests. This conversational approach is often faster and yields better results.
  4. Always Verify the Output: Treat ChatGPT as a junior analyst. It’s fast and helpful, but it can make mistakes. Always cross-reference the generated chart against your source data to make sure it’s accurate and telling the right story.

Final Thoughts

Creating charts with ChatGPT is an effective way to quickly transform raw data into easy-to-understand visualizations. By choosing between directly generating an image or producing code, you can handle everything from quick analyses for a team check-in to creating components for a bigger project, all with a few conversational prompts.

While ChatGPT is great for generating these static charts from uploaded files, the process can become clumsy when you need real-time, interactive reporting. That’s where we built Graphed to take over. Instead of uploading static CSVs, we connect directly to your data sources like Google Analytics, Shopify, and HubSpot, allowing you to ask questions in plain English and get back live dashboards that update automatically. It’s a way to move beyond single, static charts and into an always-current view of your business performance, no new prompts required.

Related Articles