
上QQ阅读APP看书,第一时间看更新
How to do it...
Draw a suitable data frame using rep() and seq() functions, them let's plot those using geom_point():
> palette <- data.frame(x = rep(seq(1,5,1),5))
> palette$y <- c(rep(5,5),rep(4,5),rep(3,5),rep(2,5),rep(1,5))
> library(ggplot2)
> ggplot(data = palette,aes(x,y)) +
geom_point(shape = seq(1,25,1), size = 10, fill ='white') +
scale_size(range = c(2, 10)) +
geom_text(nudge_y = .3, label = seq(1,25,1))
Function geom_text() is plotting the reference numbers related to each shape.