How to Create a 3D Pie Chart with ChatGPT

Cody Schneider8 min read

Thinking about using ChatGPT to make a quick 3D pie chart for your next deck or report? You’re in the right place. This guide will walk you through exactly how to turn your data into a professional-looking chart using a simple prompt, even if you’ve never touched a line of code.

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

Good Data In, Good Chart Out: Prepping Your Numbers

Before you even open ChatGPT, the single most important step is getting your data ready. Artificial intelligence is powerful, but it's not a mind reader. If you give it disorganized or confusing data, you’ll get a disorganized or confusing chart - or just an error message.

For a pie chart, you need data that fits into two simple categories:

  • Labels: These are the names of each slice of your pie (e.g., "Organic Search," "Paid Social," "Referral Traffic").
  • Values: These are the numbers corresponding to each label (e.g., 1,520 users, 980 users, 450 users).

The best way to format this for ChatGPT is in a clean, simple table format you can copy and paste directly into the prompt. Avoid extra text, notes, or complicated formatting. Just give it the raw data.

Let's use an example. Imagine you want to visualize your website's traffic sources for last month. Your data might look something like this:

Source,Users
Organic Search,1520
Paid Social,980
Email Marketing,750
Direct,610
Referral,340

That's it. Simple, clean, and perfectly formatted for an AI to understand. With your data squared away, you're ready to start prompting.

A Quick Note on 3D Pie Charts

Before moving on, it’s worth mentioning that data visualization experts often advise against using 3D pie charts. The 3D perspective can make it difficult to accurately compare the size of the slices. Slices in the foreground may appear larger than they are, while those in the back seem smaller. For deep, nuanced analysis where precision is critical, a standard 2D pie chart, or better yet, a simple bar chart, is usually the better choice.

So, when should you use a 3D pie chart? They excel at adding a bit of visual flair to presentations, dashboards, and reports where the goal is to show general proportions in an engaging way. They look modern and can make a slide deck pop. Just be mindful of their limitations when it comes to precise data analysis.

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.

How to Create a 3D Pie Chart with ChatGPT: Step-by-Step

Now for the fun part. ChatGPT won't give you a JPG or PNG file directly. Instead, it will write Python code that generates the chart. Don't worry, you don't need to know Python. You just need to know how to copy the code and where to paste it.

Step 1: Write a Clear and Specific Prompt

Your prompt should tell ChatGPT exactly what you want it to do. A great prompt for creating a chart includes four key elements:

  1. The Goal: Clearly state that you want a "3D pie chart."
  2. The Data: Paste your cleanly formatted data directly into the prompt.
  3. The Tools: Tell it what to use. For this task, the best choice is "Python with the Matplotlib library." Matplotlib is a standard data visualization library, and specifying it gives ChatGPT clear instructions.
  4. The Customizations (Optional): Ask for a title, specific colors, or for a certain slice to be highlighted.

Example Prompt 1 (Simple): Let's use our website traffic data to create a basic 3D pie chart. Our prompt could be:

Using Python and Matplotlib, create a 3D pie chart based on the following data of website traffic sources. Please use a shadow to create the 3D effect.

Here is the data:
Source,Users
Organic Search,1520
Paid Social,980
Email Marketing,750
Direct,610
Referral,340

Example Prompt 2 (With Customizations): Want a little more control? You can add details to your prompt. For example, let's say you want to highlight "Paid Social" and give the chart a title.

Using Python and Matplotlib, create a 3D pie chart based on the following website traffic data.

Data:
Source,Users
Organic Search,1520
Paid Social,980
Email Marketing,750
Direct,610
Referral,340

Please customize it with the following instructions:
1.  Give the chart the title "Monthly Website Traffic by Source".
2.  Make the "Paid Social" slice stand out by "exploding" it from the rest of the pie.
3.  Display the percentage for each slice directly on the chart.
4.  Add a shadow to give it a 3D feel.
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 2: Get the Code from ChatGPT

After you enter your prompt, ChatGPT-4 (especially with its Code Interpreter tool) will generate a block of Python code. It should look something like this:

import matplotlib.pyplot as plt

# Data for the pie chart
labels = ['Organic Search', 'Paid Social', 'Email Marketing', 'Direct', 'Referral']
sizes = [1520, 980, 750, 610, 340]

# 'Explode' the 2nd slice (Paid Social)
explode = (0, 0.1, 0, 0, 0)

fig, ax = plt.subplots()
ax.pie(sizes, explode=explode, labels=labels, autopct='%1.1f%%',
       shadow=True, startangle=90)
ax.axis('equal')  # Equal aspect ratio ensures that pie is drawn as a circle.

# Add a title
plt.title("Monthly Website Traffic by Source")

plt.show()

Don't get intimidated by the code. Your only job is to copy it.

Step 3: Run the Code in Google Colab

So where do you use this code? You need a place to run Python, but you don't need to install anything on your computer. The easiest and most accessible tool for this is Google Colab, a free online Python environment.

Here’s what to do:

  1. Go to https://colab.research.google.com/.
  2. Click on "New notebook" in the welcome pop-up.
  3. You'll see a screen with a "code cell." Paste the entire block of code that ChatGPT generated into this cell.
  4. Click the Play button (a small triangle in a circle) to the left of the cell.

After a few seconds, voila! Your 3D pie chart will appear right below the code cell. From here, you can right-click on the image to save it to your computer and use it in your presentations, reports, or social media posts.

Step 4: Refine Your Chart with Follow-Up Questions

What if the chart isn't quite right? Maybe you don't like the colors, or you decided you don't want to highlight a slice after all. The beauty of ChatGPT is that it's a conversation.

You can use simple, follow-up prompts to make changes without starting over. Just refer back to the code it already gave you.

Examples of Follow-Up Prompts:

  • "Thanks, can you update the code to use a different color scheme? I'd like a blue and green palette."
  • "Actually, please remove the 'explode' effect from the 'Paid Social' slice."
  • "Can you make the font size of the labels bigger?"
  • "Change the title to 'Q3 Traffic Sources'."

For each request, ChatGPT will generate a new block of code reflecting your changes. Just copy the updated code, paste it back into your Google Colab notebook (you can replace the old code or add a new cell), and run it again to see your refined chart.

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.

Troubleshooting Common Issues

Sometimes things don’t go perfectly on the first try. Here are a few common hiccups and how to fix them.

Problem: The Chart Labels are Overlapping or Hard to Read.

Solution: This happens when you have many slices with long labels. You have two options:

  • In your prompt, ask ChatGPT to make the chart image larger. (e.g., "Update the code to make the plot have a figure size of 10x10 inches.")
  • Manually shorten your labels in the initial data you provide. (e.g., Shorten "Email Marketing Campaign" to just "Email".)

Problem: ChatGPT Gives Me an Error in the Code.

Solution: Although rare for simple charts, it can happen. If you run the code in Google Colab and get an error message, don’t panic. The solution is simple: copy the entire error message, go back to ChatGPT, and say, "This code produced the following error. Can you fix it?" In most cases, ChatGPT will apologize, identify its mistake, and provide a corrected block of code.

Final Thoughts

Using ChatGPT to generate presentation-ready charts is a massive time-saver, letting you create custom visuals without fiddling with complex design tools or learning to code yourself. By preparing your data, writing clear prompts, and using a free tool like Google Colab to run the code, you can build impactful 3D pie charts in minutes.

While this process is a huge leap forward from manual chart building, it still involves some friction - copying data, pasting code, and saving static images. At https://www.graphed.com/register, we’ve built a platform that removes these final steps. You connect your data sources (like Google Analytics, Shopify, or your ads platforms) directly, then just ask in plain English for what you want to see. Your charts and dashboards are generated instantly, update in real-time, and are fully interactive, helping you move from a question to an insight without a single line of code.

Related Articles