Recreating 'Unknown Pleasures' graphic
For some time I’ve wanted to recreate the cover art from Joy Division’s Unknown Pleasures album. The visualisation depicts successive pulses from the pulsar PSR B1919+21, discovered by Jocelyn Bell in 1967.
After reading the CSV data into
pulsar I applied some light wrangling (the raw data is a matrix).
library(dplyr) library(tidyr) pulsar <- read.csv(CSV_URL, header = FALSE) %>% mutate(row = row_number()) %>% gather(col, height, -row) %>% mutate( col = sub("^V", "", col) %>% as.integer() )
Thanks to the ggridges package, making the plot was simple.
ggplot(pulsar, aes(x = col, y = row, height = height, group = row)) + geom_ridgeline(min_height = min(pulsar$height), scale= 0.2, size = 1, fill = "black", colour = "white") + scale_y_reverse() + theme_void() + theme( panel.background = element_rect(fill = "black"), plot.background = element_rect(fill = "black", color = "black"), )
A few things worth noting:
- To get the sense of the rows right I had to reverse the direction of the y-axis (this was also important to ensure that the animation reveals from top to bottom).
- It’s necessary to set both the
plot.backgroundotherwise you get an irritating white outline.
transition_states() from the gganimate package I turned the static plot into an animation. I applied
shadow_mark() with a value of
alpha just below 1 to allow a small amount of transparency between each of the layers as the animation accumulates. This effect is not present in the original graphic, but I think that it’s informative to be able to see what’s happening “behind” each of the layers.