I have a data like contingency table, which display abundance of data, but I want to draw venn diagram from this data fram.
Structure of my data:
species_abundance<-data.frame(Genus = c("Parasphingorhabdus", "Loktanella", "Cytobacillus", "Paracoccus", "Paucisalibacillus", "Kytococcus", "Salinibacterium", "Acinetobacter baumanni","Marinococcus","Bacillus"),
S3 = c(0, 0, 1, 1, 0, 0, 1,0,4,0),
S5 = c(0, 0, 0, 1, 1, 0, 1,0,3,5),
S7 = c(3, 1, 0, 2, 0, 1, 0,0,3,1),
S9 = c(0, 1, 0, 3, 0, 0, 0,1,2,0)
How can I draw venn diagramm from this data frame in order to find unique and shared species accross different stations (S3, S5, S7.......)?
If I convert the data as given below and I try using Venny2 I will get such image, similar image and finding I want to do using R, kindly help
species_abundance1<-data.frame(S3 = c("", "", "Cytobacillus", "Paracoccus", "", "", "Salinibacterium","", "Marinococcus", ""),
S5 = c("", "", "", "Paracoccus", "Paucisalibacillus", "", "Salinibacterium","", "Marinococcus","Bacillus"),
S7 = c("Parasphingorhabdus", "Loktanella", "", "", "", "Kytococcus", "","", "Marinococcus","Bacillus"),
S9 = c("", "Loktanella", "", "", "", "", "","Acinetobacter baumanni", "Marinococcus",""))
There are a couple of ways of getting a 4-variable Venn diagram in R, but Venn diagrams beyond this number of categories are extremely complicated and not a great way of visualising data. Here is an example of a 5-category Venn diagram from Wikimedia commons:
A 7-category Venn can't even be drawn using ellipses, and involves a complex floral shape as can be seen in the linked article.
In any case, you can see that a Venn even with 5 categories would not be a very user-friendly way to represent the data.
In your case, the natural way to present this kind of data would be via a heatmap. You first need to reshape your data into long format.
Addendum
If you really want a 5-category Venn diagram which shows the number of species that the 5 sites have in common, you can do:
Despite being far more difficult to read / understand, this also contains less information than the heatmap. For example, I can see from the Venn that there is a single species that only S3 and S5 have in common, but I can see that just as clearly from the heatmap. Furthermore, I can tell you the Genus (it's paracoccus), and how many observations of it there were at each site using the heatmap. You can't do this with a Venn diagram. A Venn is simply the wrong tool for presenting the data you have.