Monday, April 8, 2013

RG#33: Bubble plot

# Bubble plot
# data
dataf <- data.frame (X = c(12, 18, 20, 6, 14, 15, 13, 5, 2, 18, 25), Y = c(6, 8, 12, 16, 4, 5, 3, 5, 12, 8, 15), Z = c(4, 2, 4, 3, 4, 8, 6, 2, 2, 8, 5))

# in base
radius = dataf$Z / max(dataf$Z)
symbols(dataf$X, dataf$Y, circles=radius, inches=0.10, fg="white", bg=" darkorchid4")


require(ggplot2)
qplot(X, Y, data= dataf, size= Z, col = "darkorchid")+ theme_bw()

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.