How to Generate Graphs and Charts in Code Interpreter by OpenAI


OpenAI’s Code Interpreter is doing wonders ever since it got launched. And if you are eager to learn how to Generate Graphs and Charts by using the tool, this short blog post is for you.

Let’s get to it…

Using OpenAI’s Code Interpreter to Generate Graphs and Charts

Below, I will be providing you with 2 different example prompts along with working screenshots so that you can get it done easily.

🎉 For this operation, uploading files is completely optional. The output will just be fine even without uploading any files, depending upon the prompt given.

Prompt #1

Plot a chart showcasing the top 10 countries based on their population using public available data.

Prompt #1 to Generate Graphs and Charts in OpenAI's Code Interpreter

This prompt instructs the Code Interpreter to generate code that creates a chart. The chart visualizes the top 10 countries by population, using publicly available data as its source.

Prompt #2

Generate a visual chart based on the uploaded data. The data is in the CSV format that you should accurately interpret and create a meaningful graph representing so that the uploaded data can be easily visualized.

Prompt #2 to Generate Graphs and Charts in OpenAI's Code Interpreter

This prompt directs the Code Interpreter to create a graphical representation from an uploaded CSV data file. It involves reading the CSV file, accurately interpreting its contents, and then generating a chart that effectively visualizes the data.

🎉 You can modify the above prompts as per your use case to get the desired output. OpenAI’s GPT-4 is powerful and properly understands any prompt you provide.

Also, check some other interesting things that you can do with the OpenAI’s Code Interpreter model:

I have also written a detailed post about the practical use cases of the Code Interpreter model that you may find helpful.

And if you get stuck somewhere, kindly feel free to let me know in the comments below.

Google Sheets + OpenAI API (Script)

A script to connect Google Sheets with the OpenAI API without third-party tools like Zapier or Make. This “script” allows instant access to responses from GPT-4 and GPT-3.5 inside the spreadsheet itself.

  • No 3rd party tools required
  • No subscription required, and
  • Works with a free Gmail account as well

🎉 Costs $10 (one time)

✦ Assistance from an AI engine was utilized in writing and/or editing this post to enhance its quality.


4 responses to “How to Generate Graphs and Charts in Code Interpreter by OpenAI”

Leave a Reply

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

  1. Ario Avatar

    do you have a code for you text:
    “How to Generate Graphs and Charts in Code Interpreter by OpenAI”


    1. DeepakNess Avatar

      Hi, you do not need a code for this. Just provide all the data and ask it to generate the charts.

  2. Willie Epps III Avatar
    Willie Epps III

    Thanks for some HOPE. I am in MBA business class. I have little idea about making tables and charts. This class focuses on analyzing data using these formats like bar chart, pie chart and frequency table. Anymore tips on using tables and charts?

    1. DeepakNess Avatar

      Yes, totally possible. But you will require a paid ChatGPT Plus account and you can just provide the data and ask the GPT-4 model to plot the chart.

      It works!