#Access the data: a <- read.table("http://www.stat.ucla.edu/~nchristo/statistics13/nh_counties_dems_2016.txt", header=TRUE) plot(a$x,a$y, xlab="Longitude", xlim=c(-72.8, -70.5),ylim=c(42.7, 45.3), ylab="Latitude", main="New Hampshire Democratic primary - 2016", "n") #Maps package: library(maps) map("county", "new hampshire",add=TRUE) #Use the difference percent1-percent2: dif=a$percent1-a$percent2 #Create the bubble plot: points(a$x,a$y, cex=dif/mean(dif), pch=19) #Add a legend to the plot: legend("topleft",pt.cex=c(quantile(dif, c(0.25, .50, 0.75))/mean(dif)),pch=c(19,19,19), legend=c(round(quantile(dif, c(0.25, .50, 0.75)),2)), col=c("black", "black", "black"))