Charting the Future: How to Use ChatGPT to Draw Graphs and Charts

ChatGPT, OpenAI’s cutting-edge language model, is no longer just a marvel of text generation—it’s also your new best friend in the world of data visualization.

In this article, we’ll explore 4 versatile techniques that every ChatGPT user, regardless of subscription status, can utilize to transform data into compelling, easy-to-understand visuals.

Prepare to open new doors of insight and communication, because the future of data is not only about numbers—it’s also about telling a story.

Using Code Interpreter

OpenAI’s Code Interpreter, an extension for ChatGPT, elevates the AI’s capacity to pen Python code, particularly for data analysis and visualization. Python is well-known for its prowess in these areas.

Code Interpreter shines in its ability to upload files directly. It’s a breeze to upload various file formats, including Excel, CSV, PDF, and others, to ChatGPT for analysis. From crafting simple Excel visuals to undertaking intricate machine learning models, it’s all achievable through conversations.

In a previous article, I’ve used a Kaggle dataset to try out various data analysis techniques with Code Interpreter.

It went beyond my expectations by automatically producing graphs aligned with my analysis goals, even though I didn’t specifically ask for them. Plus, you can interact with Code Interpreter to generate and tweak charts to your liking.

Here are some sample graphs I created:

Histogram:

chatgpt code interpreter output content added on netflix over the year

Line chart:

chatgpt code interpreter output numbers of movies in top 5 genres over time

Word cloud:

chatgpt code interpreter output word cloud

Heat map:

chatgpt code interpreter output associations between top 20 directors and genres

Using “Show Me Diagrams” ChatGPT Plugin

ChatGPT Plus users can use the Show Me Diagrams plugin to create many graphic types, including bar, line, and scatter charts, streamgraphs, circular plots, box plots, maps, and more. With this plugin, you can also draw diagrams for system and process visualization like flowcharts and mind maps.

To use it, ensure that the ChatGPT plugin feature is activated.

chatgpt user interface
open chatgpt setting
chatgpt plugin setting beta features

Visit the ChatGPT Plugin Store, search for the plugin, and click “Install”.

chatgpt plugin show me diagrams installation

After installation, switch to ChatGPT4 and access the “Plugins” button from the “GPT-4” drop-down menu.

switch to chatgpt4
chatgpt4 activate plugin function

Check the “Show Me Diagrams” plugin.

activate chatgpt plugin show me diagrams

Then enter your prompt. I will use this sample table for demonstration.

DateProductProduct CategoryUnits SoldRevenue
7/1/2023AppleFruits10$15.00
7/2/2023BananaFruits20$12.00
7/3/2023OrangeFruits15$10.50
7/4/2023TomatoVegetables12$18.00
7/5/2023PotatoVegetables25$20.00
7/6/2023CarrotVegetables18$14.40
7/7/2023PeachFruits8$11.20
7/8/2023WatermelonFruits5$25.00
7/9/2023CucumberVegetables30$22.50
7/10/2023AppleFruits12$18.00
7/11/2023BananaFruits22$13.20
7/12/2023OrangeFruits17$11.90
7/13/2023TomatoVegetables10$15.00
7/14/2023PotatoVegetables28$22.40
7/15/2023CarrotVegetables16$12.80
7/16/2023PeachFruits6$8.40
7/17/2023WatermelonFruits7$35.00
7/18/2023CucumberVegetables35$26.25
7/19/2023AppleFruits11$16.50
7/20/2023BananaFruits21$12.60
7/21/2023OrangeFruits16$11.20
7/22/2023TomatoVegetables11$16.50
7/23/2023PotatoVegetables30$24.00
7/24/2023CarrotVegetables20$16.25
7/24/2023CarrotVegetables20$16.00
7/25/2023PeachFruits9$12.60
7/26/2023WatermelonFruits8$40.00
7/27/2023CucumberVegetables40$30.00
7/28/2023AppleFruits14$21.00
7/29/2023BananaFruits25$15.00
7/30/2023OrangeFruits20$14.00
7/31/2023CarrotVegetables30$24.00

This table illustrates the sales data of vegetable and fruit products for July 2023, which includes the Date, Product, Product Category, Units Sold, and Revenue.

First, I copied and pasted the table directly from Excel into ChatGPT and asked it to draw a pie chart showing the sales of each category for me:

chatgpt plugin show me diagram draw a pie chart

You can view this diagram in a new tab by clicking the hyperlinks in ChatGPT’s response.

You can also click the text hyperlink “You can edit this diagram online if you want to make any changes” to edit the pie chart in a new tab.

An online editor will open, displaying the pie chart’s code on the left side.

mermaid live editor

You can modify the pie chart by changing the code. If you’re not familiar with the Mermaid language, you can ask ChatGPT to modify the pie chart according to your preferences.

Let’s generate another chart. I asked ChatGPT to create a bar chart that illustrates the total sales of each product. Here is its response:

chatgpt plugin show me diagram draw a bar graph

Similarly, you can open a new tab to view or edit this bar chart online.

Using “Daigr.am” ChatGPT Plugin

Just like the Show Me Diagrams plugin, Daigr.am also enables the creation of various charts. Instructions on how to install and activate it can be found under the Show Me Diagrams subsection. I’ll input the same prompt as before into ChatGPT to see what Daigr.am can generate.

chatgpt plugin dai.gram draw a pie chart

You can save the resulting pie chart as an SVG image by right-clicking on it. Clicking the hyperlinked “here” will open the pie chart in a new tab, which offers dynamic color changes when hovering over different sections.

chatgpt plugin dai.gram pie chart animation

Another cool feature is the dark mode, toggled by clicking on the sun icon at the top right.

chatgpt plugin dai.gram pie chart dark mode

Let’s also have ChatGPT generate a line chart to depict daily sales trends.

chatgpt plugin dai.gram draw a line graph

Click on the “here” hyperlink again to view this in a new tab.

Leveraging the ChatGPT Wolfram Plugin

Wolfram is another ChatGPT plugin that generates charts, albeit as a secondary feature. It’s capable of complex mathematical calculations and answering specialized questions. I’ve covered this in a previous article.

Let’s use a prior table and have Wolfram generate a pie chart from it.

chatgpt plugin wolfram draw a pie chart

The result is a basic pie chart, lacking sales data or category percentages. The image can be saved by right-clicking on it. Next, we’ll have it generate a line chart.

draw line graph with wolfram chatgpt plugin

Though the line chart from Wolfram is somewhat crude and lacks daily sales data compared to Daigr.am, Wolfram’s strength lies elsewhere.

For example, when asked about China and the US’s population growth and rates over the past 50 years, it gave two line graphs from 1970-2021.

ask wolfram chatgpt plugin about chinese vs us population growth rate

ChatGPT with Daigr.am, however, could only provide a general text description. It suggested checking the historical data from reliable sources like the World Bank or the UN population database for more accurate information.

chatgpt plugin daigr.am answer question about population growth rate

Wolfram’s power lies in its ability to tap into numerous reliable specialized databases, covering topics like demographics, economics, sociology, and more. If you need data-based charts in your field, this is the plugin to use.

wolfram data repository

Getting ChatGPT to Generate Code for Charts

The previous methods are only available to Plus users via the ChatGPT plugins. However, anyone can generate charts with ChatGPT. Let’s see how through another example. I still copied and pasted the previous table directly into ChatGPT and asked it to create a pie chart to represent the total sales of the two categories.

DateProductProduct CategoryUnits SoldRevenue
7/1/2023AppleFruits10$15.00
7/2/2023BananaFruits20$12.00
7/3/2023OrangeFruits15$10.50
7/4/2023TomatoVegetables12$18.00
7/5/2023PotatoVegetables25$20.00
7/6/2023CarrotVegetables18$14.40
7/7/2023PeachFruits8$11.20
7/8/2023WatermelonFruits5$25.00
7/9/2023CucumberVegetables30$22.50
7/10/2023AppleFruits12$18.00
7/11/2023BananaFruits22$13.20
7/12/2023OrangeFruits17$11.90
7/13/2023TomatoVegetables10$15.00
7/14/2023PotatoVegetables28$22.40
7/15/2023CarrotVegetables16$12.80
7/16/2023PeachFruits6$8.40
7/17/2023WatermelonFruits7$35.00
7/18/2023CucumberVegetables35$26.25
7/19/2023AppleFruits11$16.50
7/20/2023BananaFruits21$12.60
7/21/2023OrangeFruits16$11.20
7/22/2023TomatoVegetables11$16.50
7/23/2023PotatoVegetables30$24.00
7/24/2023CarrotVegetables20$16.25
7/24/2023CarrotVegetables20$16.00
7/25/2023PeachFruits9$12.60
7/26/2023WatermelonFruits8$40.00
7/27/2023CucumberVegetables40$30.00
7/28/2023AppleFruits14$21.00
7/29/2023BananaFruits25$15.00
7/30/2023OrangeFruits20$14.00
7/31/2023CarrotVegetables30$24.00

Prompt for ChatGPT:

I want you to act as a data analyst. Draw a pie chart to represent the total sales of the two categories. Use Vega-Lite visualization grammar.

chatgpt create a pie chart using vega-lite

Following ChatGPT’s instructions, navigate to the “Vega Editor” website (https://vega.github.io/editor/) and paste the provided code to generate the pie chart.

chatgpt pie chart vega editor export

Click “Export” to download the chart in various formats (png, json, svg, pdf, html).

chatgpt pie chart vega editor export chart

If the chart doesn’t appear after pasting the code, refresh the page.

vega editor showing blank

Next, let’s generate a scatter chart.

Create a scatter plot to explore Product vs Units Sold to identify which products are the best sellers. Use Vega-Lite visualization grammar.

chatgpt create a scatter plot using vega-lite

Vega-Lite is a tool for creating data visualizations that is often used by data scientists, engineers and researchers. It can generate a variety of charts, including bar charts, line charts, scatter plots, streamgraphs, box plots, maps, and more.

With ChatGPT, you don’t have to learn its complex syntax. Instead, ask ChatGPT to generate the code in a dialog format. Convenient, isn’t it?

Summary

In conclusion, whether you’re a Plus user with access to plugins like Daigr.am and Wolfram, or a user interested in leveraging the power of Vega-Lite, ChatGPT has solutions to help visualize your data.

These tools demystify complex concepts, turning them into accessible, engaging visuals. Remember, you don’t need to be a data scientist to generate meaningful, informative charts. ChatGPT is your ally in making data speak volumes.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *