0

I have the following:

type <- c('a', 'b', 'c', 'a&b', 'a&c', 'b&c', 'a&b&c')
distribution <- c(.25, .1, .12, .18, .15, .05, .15)

I would like to create a bubble chart like the one shown in the selected answer to this question: Proportional venn diagram for more than 3 sets where the bubble areas are proportional to the values in the distribution vector and the connecting lines show the relationship between the 3 main bubbles 'a', 'b', and 'c'.

Community
  • 1
  • 1
drumminactuary
  • 109
  • 2
  • 11
  • 2
    Package requests are generally considered off topic. It would be better to include a small [reproducible example](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) of some data you have that you would like to visualize in this way and rephrase your question. – MrFlick Jun 18 '15 at 20:23
  • 1
    `igraph` package could be of help. – Roman Luštrik Jun 18 '15 at 20:25

1 Answers1

2

Using the igraph library with your data, you could create edges and vertices to represent your desired plot. Here's one way to do it

library(igraph)
type <- c('a', 'b', 'c', 'a&b', 'a&c', 'b&c', 'a&b&c')
distribution <- c(.25, .1, .12, .18, .15, .05, .15)

mx <- strsplit(type,"&")
ei <- sapply(mx,length)>1
cx <- do.call(rbind, mapply(cbind, type[ei], mx[ei]))

gg <- graph.edgelist(cx, directed=FALSE)    

V(gg)[type]$size<-distribution *200
plot(gg)

And this is the plot I got

enter image description here

MrFlick
  • 195,160
  • 17
  • 277
  • 295
  • Is there a way to change the color of the vertex perimeter? `list.vertex.attributes(gg)` returns "name" "size" "color". However, modifying the "color" attribute only changes the fill. – drumminactuary Jun 19 '15 at 14:45
  • 1
    Try `V(gg)[type]$frame.color<-"darkgreen"` – MrFlick Jun 19 '15 at 15:01