Skip to content

Instantly share code, notes, and snippets.

@gordonwoodhull
Created December 30, 2025 22:45
Show Gist options
  • Select an option

  • Save gordonwoodhull/b69c8f1608288e54b04e48e7038f49a2 to your computer and use it in GitHub Desktop.

Select an option

Save gordonwoodhull/b69c8f1608288e54b04e48e7038f49a2 to your computer and use it in GitHub Desktop.
Unknown Pleasures pulsar ridgeline plot - Quarto/R/ggridges reproduction
color:
palette:
black: "#000000"
white: "#FFFFFF"
dark-gray: "#222222"
gray: "#333333"
foreground: white
background: dark-gray
primary: white
secondary: gray
---
title: "Unknown Pleasures: The Pulsar Plot"
author: "Reproduced in R"
respect-user-color-scheme: true
papersize: us-letter
format:
typst:
keep-typ: true
---
## The Original Visualization
The iconic cover art of Joy Division's 1979 debut album *Unknown Pleasures* is one of the most recognizable images in music history. But before it was album art, it was science.
### Harold D. Craft Jr. and CP 1919
The visualization was created by **Harold D. Craft Jr.**, a radio astronomer and doctoral student at Cornell University.
[Craft's thesis: *"Radio Observations of the Pulse Profiles and Dispersion Measures of Twelve Pulsars"* (September 1970)]{.aside}
The image depicts **80 successive radio pulses from CP 1919**---the first pulsar ever discovered.
[CP 1919: "Cambridge Pulsar at 19 hours 19 minutes right ascension"---the naming convention used before pulsars were well understood.]{.aside}
Each horizontal line represents one pulse period of approximately 1.337 seconds, stacked vertically to reveal patterns in the signal.
The data was collected at the **Arecibo Radio Observatory** in Puerto Rico.
[Craft worked under Frank Drake, famous for the Drake Equation estimating extraterrestrial civilizations.]{.aside}
### What is a Pulsar?
[A teaspoon of neutron star material would weigh about 6 billion tons on Earth.]{.aside}
Pulsars are rapidly rotating neutron stars---incredibly dense remnants of massive stars that have exploded as supernovae. They contain roughly 10^57 protons and neutrons compressed into a sphere about 10 kilometers in radius. As they rotate, they emit beams of radio waves like a lighthouse, creating the regular pulses detected by radio telescopes.
[CP 1919 rotates once every 1.337 seconds---relatively slow for a pulsar. The fastest known pulsar spins 716 times per second.]{.aside}
```{r}
#| label: setup
#| echo: false
#| message: false
library(ggplot2)
library(ggridges)
library(brand.yml)
# Load brand colors
brand <- read_brand_yml("_brand.yml")
```
```{r}
#| label: generate-data
#| echo: false
set.seed(1919) # A nod to CP 1919
n_lines <- 80
n_points <- 300
# Generate data frame for ridgeline plot
pulsar_data <- data.frame(
x = numeric(),
y = numeric(),
height = numeric()
)
for (i in 1:n_lines) {
x <- seq(0, 10, length.out = n_points)
# Create a base signal with some gaussian pulses
# Main pulse in center with some variation
center <- 5 + rnorm(1, 0, 0.3)
width <- runif(1, 0.3, 0.6)
amplitude <- runif(1, 0.5, 1.5)
# Main pulse
signal <- amplitude * exp(-((x - center)^2) / (2 * width^2))
# Add secondary features (interpulse, noise)
signal <- signal + runif(1, 0, 0.3) * exp(-((x - (center - 2))^2) / (2 * 0.4^2))
signal <- signal + runif(1, 0, 0.2) * exp(-((x - (center + 1.5))^2) / (2 * 0.3^2))
# Add noise
signal <- signal + abs(rnorm(n_points, 0, 0.05))
pulsar_data <- rbind(pulsar_data, data.frame(
x = x,
y = factor(i, levels = 1:n_lines),
height = signal
))
}
```
```{r}
#| label: unknown-pleasures-plot
#| echo: false
#| fig-width: 8
#| fig-height: 10
#| fig-dpi: 150
#| column: page
#| out-width: 100%
# Filter to lines 2-80 to hide bottommost line (avoids artifacts)
plot_data <- pulsar_data[pulsar_data$y %in% 2:n_lines, ]
ggplot(plot_data, aes(x = x, y = y, height = height, group = y)) +
geom_ridgeline(
fill = brand$color$background,
color = brand$color$foreground,
scale = 2,
linewidth = 0.5,
min_height = 0 # Don't draw below baseline
) +
scale_y_discrete(expand = expansion(mult = c(0, 0.05)), drop = FALSE) + # 5% padding at top
scale_x_continuous(expand = c(0, 0)) +
coord_cartesian(clip = "on") +
theme_void() +
theme(
plot.background = element_rect(fill = brand$color$background, color = brand$color$background),
panel.background = element_rect(fill = brand$color$background, color = brand$color$background),
plot.margin = margin(30, 30, 30, 30)
)
```
### Path to Pop Culture
[Peter Saville removed the original caption and axis labels, reversed the colors (white lines on black), and rotated the image 90°.]{.aside}
1. **1970**: Craft's PhD thesis at Cornell
2. **1971**: Published in *Scientific American* (January issue)
3. **1974**: Appeared in *Graphis Diagrams*
4. **1977**: Included in *The Cambridge Encyclopaedia of Astronomy*
5. **1979**: Designer **Peter Saville** adapted it for Joy Division's debut album
[Joy Division took their name from the WWII term for groups of Jewish women forced into prostitution by the Nazis---a deliberately provocative choice that courted controversy.]{.aside}
When asked about finding his scientific work on an album cover, Craft said: *"I said no, I had no clue. So I went to the record store and, son of a gun, there it was."*
## Technical Notes
This reproduction uses:
- **R package**: `ggridges` version `r packageVersion("ggridges")` by Claus O. Wilke [The ggridges package was inspired by the "joy plots" trend that emerged after data scientists rediscovered this visualization style.]{.aside}
- **Visualization approach**: `geom_ridgeline()` for stacked line plots with filled areas
- **Data**: Simulated Gaussian pulses to mimic the original pulsar signal characteristics
[The hidden line algorithm was common in early computer graphics---each line is drawn front-to-back, with filled areas masking lines behind.]{.aside}
The original visualization by Harold Craft used a "hidden line" technique where peaks in the foreground obscure the lines behind them---exactly what `geom_ridgeline()` accomplishes with its fill parameter.
## References
- Craft, H.D. Jr. (1970). *Radio Observations of the Pulse Profiles and Dispersion Measures of Twelve Pulsars*. PhD thesis, Cornell University.
- Scientific American (2015). "Pop Culture Pulsar: Origin Story of Joy Division's Unknown Pleasures Album Cover"
- Wilke, C.O. ggridges: Ridgeline Plots in ggplot2. https://wilkelab.org/ggridges/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment