# creating data set columns
x <- c(12,23,43,61,78,54,34,76,58,103,39,46,52,33,11)
y <- c(12,54,34,76,54,23,43,61,78,23,12,34,56,98,67)
r <- c(1,5,13,8,12,3,2,16,7,40,23,45,76,8,7)
colors <- c(1,2,3,1,2,3,1,1,2,3,1,2,2,3,3)
# creating the dataframe from the
# above columns
data <- data.frame(x, y, r, colors)
# importing the ggplot2 library and
# RColorBrewer
library(RColorBrewer)
library(ggplot2)
# Draw plot
ggplot(data, aes(x = x, y = y,size = r, color=as.factor(colors))) +
geom_point(alpha = 0.7)+ scale_color_brewer(palette="Spectral")