Information & Interaction Design
17 Nov 2026
This is a two part exercise.
The style sheet can be a png, a pdf, or a jpg file containing the following elements.
In the Robert Johnson Page assignment box, provide the stylesheet and a link to the webpage. If you don’t have a place to host the webpage, put all the assets (the html file, a css file, and the picture file) in the assignment box so that they display there.
This is a four part exercise.
Last week you pretended to give a table and a sketch to an assistant to polish. This week the assistant is an AI. It will write an R script using ggplot2, a package built on the ideas of Bertin and of Wilkinson (2005), whom we meet next week.
Global Superstore is an Excel spreadsheet recording orders, returns, and people for a fictional store operating worldwide. We will use only the Orders worksheet, where each row is one line of an order.
Download the spreadsheet from Canvas > Files > visualization > GlobalSuperstore.xls
Posit Cloud runs R and RStudio in your browser, so there is nothing to install.
GlobalSuperstore.xlsType the following in the Console pane, one line at a time. The first line may take a few minutes and you only need to run it once.
glimpse(orders) lists every column, its type, and its first few values. You can also type View(orders) to browse the rows.
Stop here. We will look at the columns together.
In Canvas > Files > visualization, there is an example of a successful prompt, the resulting R script and the visual output. It’s the result of some knowledge of R, knowledge of data visualization, and familiarity with the superstore data.
This is an example boxplot jitterplot pair, comparing two conditions in an experiment
I need R code to conditionally install the pacman package. Then use pacman::p_load() to load the tidyverse and readxl.
I have a spreadsheet called GlobalSuperstore.xls in the working directory. I need R code to read the tab called Orders from it into a data frame called orders, then View the data frame.
From the orders data frame, I need an R script that shows ggplot-generated boxplots overlaid with jitter plots. The X axis is the column State and the Y axis is Profit. Only the six mostly frequently occurring states in the Country “United States” should be shown. Only consider orders in the Category “Furniture”. Each row represents a customer order. If a customer, represented by the column “Customer ID”, has more than one order, use the average profit from that customer. So the jitter plot should show one dot per customer rather than one dot per order. The dots in the jitter plot should have an alpha = 0.1 value so they’re more visible. The state labels on the X axis should be rotated 45 degrees so they don’t overlap. The states should be sorted by descending revenue. The boxes and jitter plots should be colored using the Blues color palette from ColorBrewer. The colors should be dictated by revenue, with the highest revenue state being the darkest blue.
# Install pacman only if it's missing, then load packages
if (!requireNamespace("pacman", quietly = TRUE)) install.packages("pacman")
pacman::p_load(tidyverse, readxl)
# Read the Orders tab
orders <- read_excel("GlobalSuperstore.xls", sheet = "Orders")
View(orders)
# US furniture orders only
us_furniture <- orders |>
filter(Country == "United States", Category == "Furniture")
# Six most frequently occurring states, with total revenue for each
state_revenue <- us_furniture |>
group_by(State) |>
summarize(n = n(), Revenue = sum(Sales)) |>
slice_max(n, n = 6, with_ties = FALSE)
# One row per customer per state: average profit across that customer's orders
customer_profit <- us_furniture |>
group_by(State, `Customer ID`) |>
summarize(Profit = mean(Profit), .groups = "drop") |>
inner_join(state_revenue, by = "State") |>
mutate(State = fct_reorder(State, Revenue, .desc = TRUE))
# Boxplots overlaid with jitter plots, colored and sorted by state revenue
ggplot(customer_profit, aes(x = State, y = Profit, color = Revenue)) +
geom_boxplot(outlier.shape = NA) +
geom_jitter(width = 0.2, alpha = 0.1) +
scale_color_distiller(palette = "Blues", direction = 1,
labels = scales::label_dollar()) +
labs(
title = "Average furniture profit per customer, top six US states",
x = "State (sorted by descending furniture revenue)",
y = "Average profit per customer",
color = "State revenue"
) +
theme(axis.text.x = element_text(angle = 45, hjust = 1))Do this part without AI.
The invariant is the topic of the graphic and gives the graphic its title, for instance Profit by market and product category.
For each component, give
Name what will carry each component: one of the two dimensions of the plane, or a retinal variable (size, value, texture, color, orientation, or shape).
Sketch the graphic on paper or on a tablet. Include the title, the axes, and a legend for each component.
Give an AI of your choice
glimpse(orders), pasted from the Console, so that the AI knows the column namesGlobalSuperstore.xlsKeep a log of every prompt you write.
The log is a document listing every prompt you wrote, in order. Save it in one of these ways.
Include prompts that failed. Do not edit them.
superstore.RCompare the chart to your specification and your sketch.
Prompt the AI at least once more to repair what you found in the critique. Note what you changed and why.
Add this line to the end of the script and run the script again.
To download a file from Posit Cloud, check its box in the Files pane, click More, then Export.
In the Superstore Visualization assignment box, provide the following.
This slideshow was produced using quarto
Fonts are Fira Sans, Fira Sans Light, and Victor Mono Nerd Font
Math is set in Fira Math via MathJax 4