I would like to produce a similar plot as the figure below. I wonder if this could be achieved using standard libraries like the base R or ggplot2?
Asked
Active
Viewed 738 times
2
-
3Please give some reproducible data – Divi May 18 '16 at 02:24
-
3You could annotate a `ggplot` to get there, but I would personally use `grid` for something like this. It doesn't seem to me like `ggplot` would get you much. – Mike Wise May 18 '16 at 02:47
1 Answers
2
Yes it can be done, altough Mike Wise might be right that using grid might be easier with the labels/text part. Here is something to help you with the plot itself:
First a circlefunction, which i took from here
circleFun <- function(center = c(0,0),diameter = 1, npoints = 100){
r = diameter / 2
tt <- seq(0,2*pi,length.out = npoints)
xx <- center[1] + r * cos(tt)
yy <- center[2] + r * sin(tt)
return(data.frame(x = xx, y = yy))
}
# and make a circles
circle1 <- circleFun(c(10,10),20,npoints = 100)
circle2 <- circleFun(c(10,10),15,npoints = 100)
circle3 <- circleFun(c(10,10),10,npoints = 100)
# then make some toy data for the points
df <- data.frame(strategy=5:10, offering=c(5,7,9,8,6,9),labelz=c("SAS","ORACLE","IBM","SAP","X-Systems","ABCD"))
maxi <- max(df$offering)/30
#and now some plotting
library(ggplot2)
library(digest) # I needed to call this seperately, should not be necessary
ggplot(data=df, aes(x=strategy, y=offering)) +
geom_polygon(data=circle1, aes(x,y), fill = "#99CCFF") +
geom_polygon(data=circle2, aes(x,y), fill = "#6699CC") +
geom_polygon(data=circle3, aes(x,y), fill = "#336699") +
geom_point(aes(size=offering*strategy),color = "white") +
geom_point(aes(size=1)) +
geom_text(aes(label=labelz), nudge_y = maxi) +
coord_cartesian(xlim=c(0,10),ylim=c(0,10)) +
theme_bw()