Skip to content

Instantly share code, notes, and snippets.

@seankross

seankross/schools.R

Created Mar 29, 2018
Embed
What would you like to do?
Graph for Clare
# You can find pch values for shapes here:
# https://cdn-images-1.medium.com/max/1600/1*0QEVFHrgqmkVsCVCQceh6w.jpeg
data <- data.frame(
Name = c("Ohio State", "Purdue", "Indiana", "Wisconsin", "Nebreaska"),
Min = c(0.37, 0.25, 0.13, 0.22, 0.28),
Max = c(0.88, 0.57, 0.68, 0.77, 0.63),
Value = c(0.51, 0.32, 0.24, 0.65, 0.57),
Pch = c(1, 2, 5, 6, 22),
stringsAsFactors = FALSE
)
# Graph margins
par(mar = c(6.1, 4.1, 3.1, 2.1))
plot(1:nrow(data),
col = "white",
ylim = c(0, 1),
xlab = "",
ylab = "Coolness",
xaxt = "n")
title(xlab = "Schools", line=5)
for (i in 1:nrow(data)) {
segments(i, data$Min[i], i, data$Max[i])
points(i, data$Value[i], pch = data$Pch[i])
}
axis(1, at = 1:nrow(data), labels = data$Name, las=2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.