Home > Blockchain >  ggVennDiagram: values inside circles by changing data do not change
ggVennDiagram: values inside circles by changing data do not change

Time:03-18

Here is part of my data:

dd<-read.table (text=" Out1 Out2
Yes NO
Yes NO
Yes NO
Yes NO
Yes NO
Yes NO
Yes NO
Yes NO
Yes NO
Yes NO
Yes NO
Yes NO
Yes NO
Yes Yes
Yes Yes
Yes NO
Yes NO
Yes NO
Yes NO
Yes NO
Yes NO
Yes NO
Yes NO
Yes NO
Yes NO
Yes NO
Yes Yes
Yes Yes
Yes Yes

", header=TRUE)

I would like to get a Veen diagram for this data using ggVennDiagram. I use the following codes to get the diagram.

ggVennDiagram(dd[1:2], label_alpha = 0)  
  ggplot2::scale_fill_gradient(low="white",high = "green")

This gives me the Venn diagram, but when I change the "Yes"s or "NO"s, the numbers do not change inside the circles?

CodePudding user response:

It seems your input data is in the wrong format. Are you perhaps looking for this?

my_list <- list(Out1 = which(dd$Out1 == "Yes"), 
                Out2 = which(dd$Out2 == "Yes")) 

ggVennDiagram(my_list, label_alpha = 0)   
  ggplot2::scale_fill_gradient(low = "white", high = "green")

enter image description here

  • Related