Data Visualization (with and without AI)

Summary:

Rich Ross is an assistant professor of statistics and a 2024-2025 Faculty AI Guide. The goal of this in-class activity was to help students explore the use of generative AI in creating data visualizations and to realize that sometimes it's easier and faster to write the code yourself.

Objectives

In this assignment, I’d like for you to practice two main skills:

  1. Making a nested pie chart (with a bonus element!)
  2. Getting a generative AI tool to write code to make a plot.

Note: I’ve found that many students can brute force their way to making a nested pie, but its almost always with the use of some specialized function or package. While this is not strictly wrong, the solution to creating this graphic is actually quite simple and I want to give students a chance to think about the structure of the graphic on purpose.

Prompt part 1

A donut plot is VERY similar to a nested pie chart. In the diamonds dataset in R, there are five different levels of the _cut_ variable. For the first 30 minutes of class, use a generative AI tool (Microsoft Copilot, ChatGPT, or another of your choosing) to attempt to get code to make a nested pie chart where the inner pie is based on whether a diamond’s carat weight is greater than 1 and the outer pie is based on the cut of the diamond, as shown below.

You must make sure that the AI tool only uses the tidyverse package. No other packages are necessary. Upload the plot you create that is CLOSEST to the target plot, but make use green and purple instead of the colors used here.

Note: I ask them to use green and purple since i had a few students just copy and paste my image. Using a watermark would be just as effective.

[At this point, students spend 25-30 minutes trying to generate the required R code using their AI tool of choice. None of the students come close to creating the right pie chart; see student samples below. This creates a "time for telling" in which Rich explains a few key principles in writing R code to create data visualizations of this type.]

Prompt part 2

Using the outline provided by Dr. Ross, try to make the target plot. Your code must match up with the outline provided in class. Upload your plot here.

#Discussion Question What was successful about using the generative AI tool? What was difficult to achieve with your chosen tool? Please mention which tool you used as well.

[Given the additional instruction, almost all students are able to create the proper pie chart without using AI.]

Target Pie Chart
Sample Student Pie Charts