How to Create a Donut Chart with ChatGPT

Cody Schneider8 min read

You no longer need to be a spreadsheet expert or master a complex BI tool to visualize your data. With the power of AI, you can create a clean, professional-looking donut chart just by asking for it. This guide walks you through the entire process, from preparing your data to crafting the perfect prompts for ChatGPT and refining the final visual.

GraphedGraphed

Build AI Agents for Marketing

Build virtual employees that run your go to market. Connect your data sources, deploy autonomous agents, and grow your company.

Watch Graphed demo video

What is a Donut Chart and When Should You Use It?

Think of a donut chart as a pie chart with a hole in the middle. Like its cousin, the pie chart, a donut chart is used to show the proportions of a whole. Each "slice" of the donut represents a category, and the size of the slice corresponds to its percentage of the total. That empty space in the center isn't just for looks, it can be a great spot to display the total value you're analyzing or to add a key title.

Donut charts are excellent for answering questions like:

  • What percentage of our website traffic comes from each channel?
  • How is our marketing budget distributed across different platforms?
  • What are the most popular product categories by sales volume?
  • What were the results of our customer satisfaction survey?

However, they aren’t a one-size-fits-all solution. They become cluttered and hard to read if you have too many categories (typically more than five or six). They are also not ideal for showing changes over time or comparing multiple datasets side-by-side. For those use cases, a bar chart or line graph would be a better choice.

Preparing Your Data for ChatGPT

Before you can ask ChatGPT to work its magic, you need to give it something clean and clear to work with. AI can seem intelligent, but it isn't a mind reader. The quality of your output is directly tied to the quality of your input. Providing well-structured data is the most important step in this entire process.

Choose a Simple and Clear Dataset

For your first attempt, don't overwhelm the AI with a massive, multi-tabbed spreadsheet. Start with a straightforward dataset that is easy to understand. The best format for a donut chart is a simple two-column table:

  • Column 1: Categories. These are the labels for your slices (e.g., 'Organic Search', 'Social Media').
  • Column 2: Values. These are the numbers corresponding to each category (e.g., sessions, sales, number of responses).

Imagine you want to visualize where your website traffic comes from. Your data might look like this:

Traffic Source,Users Organic Search,1500 Social Media,850 Referral,400 Direct,650 Paid Search,700

Free PDF · the crash course

AI Agents for Marketing Crash Course

Learn how to deploy AI marketing agents across your go-to-market — the best tools, prompts, and workflows to turn your data into autonomous execution without writing code.

Clean and Format Your Data

Ensure your data is tidy. This means checking for common errors that can confuse the AI:

  • Consistency is Key: Make sure category names are consistent. 'Social Media' and 'social media' might be treated as two different categories.
  • No Empty Cells: Remove any blank rows or cells within your data range.
  • Just the Facts: Exclude totals, subtitles, or any other extra text from the core data table. You want a plain table of categories and values.

You can save this data as a Comma-Separated Values (.csv) file or simply prepare it in a plain text editor to copy and paste directly into ChatGPT.

Step-by-Step: Creating a Donut Chart with ChatGPT

With your clean data in hand, you’re ready to create your chart. Note that this process requires a ChatGPT Plus subscription, as it relies on the Advanced Data Analysis feature (formerly known as Code Interpreter) to execute code and generate visualizations.

Step 1: Start a Chat and Provide Your Data

First, navigate to ChatGPT and make sure you have GPT-4 selected at the top. You'll see a small paperclip icon to the left of the input box. Click this to upload the .csv file you prepared earlier.

Alternatively, if you have a small dataset, you can often just copy the table and paste it directly into the chat box along with your first prompt. Both methods work well, but uploading a file is generally more reliable for larger datasets.

Step 2: Crafting Your Initial Prompt

This is where you tell the AI what you want. Your first prompt should be clear and concise. Start with the basics and you can build from there. Using our website traffic example, a great starting prompt would be:

Using the data I've provided, please create a donut chart showing the distribution of users by traffic source.

Let's break down why this is an effective prompt:

  • It specifies the data source: "Using the data I've provided..."
  • It names the chart type: "...create a donut chart..."
  • It defines the relationship: "...showing the distribution of 'users' by 'traffic source'." (Explicitly mentioning the column names is a best practice).
GraphedGraphed

Build AI Agents for Marketing

Build virtual employees that run your go to market. Connect your data sources, deploy autonomous agents, and grow your company.

Watch Graphed demo video

Step 3: Interpreting the Output

ChatGPT will first confirm that it understands your request. It will show you the Python code it's writing and running in the background to analyze your data and build the chart. You don't need to understand this code, but it's a helpful look behind the curtain that confirms it's actually processing your data.

After a few seconds, it will generate a static image of your donut chart and display it directly in the chat. It will likely be a very basic-looking chart at first, perhaps with default colors and minimal labeling, but it's a solid starting point.

Step 4: Refining and Customizing Your Chart

Here’s the fun part. You don't need to write a whole new prompt to make changes. You can simply ask for adjustments conversationally. This iterative process is what makes using AI for data visualization so powerful.

Here are some common follow-up prompts you can use to customize your chart:

  • To change the colors: This looks great. Can you change the colors? Make 'Organic Search' a shade of blue, 'Paid Search' a shade of green, and the rest in shades of gray.
  • To add a title and labels: Please add a title to the chart called "Website Traffic Sources Last Month." Also, add percentage labels to each slice directly on the chart.
  • To emphasize a key section: Can you make the 'Organic Search' slice "explode" out slightly from the rest of the chart?
  • To adjust the anatomy of the chart: Make the hole in the center a bit wider and add the total number of users inside of the hole.

With each request, ChatGPT will generate a new version of the chart reflecting your changes. You can continue this back-and-forth until the visualization perfectly matches what you need. When you’re finished, you can simply right-click the image to save it.

Common Pitfalls and How to Fix Them

While the process is usually smooth, you might run into a few bumps. Here are some common issues and how to navigate them.

Problem: ChatGPT Misunderstands Your Data

Cause: This almost always goes back to messy or unstructured data. If you have extra columns, inconsistent naming, or merged cells, the AI might get confused about what to plot.

Solution: Go back and review your initial dataset. Make sure it's a simple, two-column table with clear headers. Re-upload the cleaned file and start your prompt again.

Problem: The Chart Looks Wrong (Incorrect Type or Data)

Cause: A vague prompt. If you just say "visualize this data," ChatGPT might guess at the chart type you want - and it may guess wrong. Similarly, if you don't specify which columns to use for categories and values, it might mix them up.

Solution: Always be specific in your initial prompt. State the chart type ("donut chart") and explicitly name the columns ("plot 'Users' against 'Traffic Source'").

Free PDF · the crash course

AI Agents for Marketing Crash Course

Learn how to deploy AI marketing agents across your go-to-market — the best tools, prompts, and workflows to turn your data into autonomous execution without writing code.

Problem: It Gives an Error or Fails to Generate

Cause: Occasionally, the AI's code can hit a snag. This is rare with simple charts but can happen.

Solution: The easiest fix is to simply ask it to try again. A simple prompt like That didn't work, can you try generating the chart again? often resolves the issue. If it points out a specific problem (like non-numeric data in your values column), address that issue in your source file and re-upload.

Problem: Remembering the Limitations

It's important to remember what ChatGPT is doing here: it's generating a static image file (a PNG). This is not an interactive dashboard.

  • You can't hover over slices to get more details.
  • You can't filter the data on the fly.
  • The chart is not connected to a live data source. If your numbers change, you have to repeat this entire process.

This workflow is perfect for one-off presentations, reports, or quick analyses. But it’s not built for ongoing, real-time business monitoring.

Final Thoughts

With a little bit of data prep and some clear communication, you can leverage ChatGPT as a powerful assistant to quickly generate custom donut charts. The ability to refine and update visuals using simple, conversational language saves a significant amount of time compared to hunting for the right settings in traditional spreadsheet software.

While using ChatGPT this way is fantastic for creating static reports, we know that your company's data is always changing. If you find yourself constantly uploading new CSVs just to get an updated view, we built a better way. Instead of creating one-off images, Graphed connects directly to your live data sources - like Google Analytics, Shopify, and Salesforce - so your visualizations are always up-to-date. You can still ask for a donut chart in plain English, but we'll deliver it in a real-time, interactive dashboard that automatically refreshes, saving you from the manual cycle of exporting, uploading, and prompting.

Related Articles