On-Demand Tutorial

Visualizing Data with ChatGPT:
Turning Analysis into Insight

In this second part of our series on data analysis with ChatGPT, Brandon Krakowsky, Director of Data Science & Research at the Wharton AI and Analytics Initiative, explores how to create clear, insightful data visualizations. You’ll learn how to generate charts, refine them with filters, highlight trends, and extract insights — all within ChatGPT. To access the files you’ll create in this tutorial, click here.

1. Creating Your First Visualizations

Start by asking ChatGPT to generate a few common charts based on your dataset. For example:

“Create a line chart of monthly sales over time, a box plot showing profit distribution by category, and label each visualization.”

ChatGPT will automatically produce visualizations such as:

  • Line plots for trends (e.g., monthly sales over time)
  • Box plots for distributions and outliers (e.g., profit by product category)
  • Bar plots for comparisons (e.g., return rate or total sales by region)

These visuals help you spot patterns in sales, profits, and returns quickly.

2. Refining Charts with Filters and Categories

Once your charts are generated, you can make them more specific:

“Show monthly sales over time separated by product category.”
“Filter to only show data from July 2016 to July 2017.”

ChatGPT can color-code categories, apply filters, and update legends automatically. This makes it easy to focus on specific time frames or product lines without manually editing code.

3. Analyzing Returns, Regions, and Segments

Beyond sales, you can use ChatGPT to explore product and customer performance:

  • Return rate by category: Visualize the proportion of returned orders for each product group.
  • Sales by region: Show total sales per geographic area.
  • Profit by customer segment: Identify which customer groups drive the most profit.

ChatGPT will handle data merging and calculations automatically, then display the results as a bar plot or table.

4. Identifying Trends and Seasonality

Ask ChatGPT to highlight key insights or patterns in your charts:

“What patterns can you identify in the monthly sales over time chart?”

For example, it might point out recurring spikes in Q4. You can even take it further:
“Shade the Q4 periods in the background to highlight seasonal spikes.”

This allows you to layer visual context directly into your plots.

5. Verifying and Exporting Your Work

You can ask ChatGPT to display the code it generated and export everything as downloadable files:

“Show all code used so far and provide a Python script and Jupyter notebook file.”

This lets you continue the work outside of ChatGPT — for example, adjusting the code, running it locally, or integrating it into a larger project.

Finally, you can create a shareable summary:

“Create a report summarizing the results and visualizations.”

ChatGPT will compile your analysis into a formatted report you can download.

By Brandon Krakowsky, Director, Data Science and Research, Wharton AI & Analytics Initiative

Pro Tips for Better Visuals

A few small habits can make your analysis more effective:

  • If available, use the Seaborn data visualization library to ensure consistent style and visuals across all charts.
  • Use filters sparingly — focus on specific ranges or categories that tell a story.
  • Validate surprising results by having ChatGPT re-run the calculation.
  • Export often so you always have clean versions of your code and figures.

These simple steps keep your workflow organized and your results reproducible.