Question: write total number of elements within labels of Venn diagram
0
gravatar for grant.hovhannisyan
4 weeks ago by
grant.hovhannisyan960 wrote:

Hi Biostars,

The post was initially published in Stack Overflow since its about coding, but I did not get any suggestions on how to solve the problem, so hope to get some insights here.

I want to write the total number of elements in the label of each circle of Venn diagram using VennDiagram library in R.

Suppose I have two data frames (the first columns are row names).

Df1

C1_01740W_A 71.69347 1.818192 0.46667755 3.896036 9.777989e-05 8.451075e-04
C1_02340C_A 68.04825 2.434093 0.39890494 6.101938 1.047900e-09 3.557006e-08
C1_02690C_A 47.80261 3.086803 0.56129955 5.499386 3.811158e-08 8.872260e-07
C1_04010C_A 306.35146 1.920717 0.18041009 10.646393 1.812521e-26 5.005852e-24
C1_04500W_A 2063.92967 1.827202 0.09031012 20.232532 5.063494e-91 3.076579e-87

Df2

C1_11340W_A 48.13831 2.201762 0.5518875 3.989512 6.620927e-05 2.376874e-03
C3_04730C_A 26.54770 2.610197 0.8984530 2.905213 3.670030e-03 4.236766e-02
C5_04250W_A 36.58761 1.827967 0.5389795 3.391533 6.950268e-04 1.315691e-02
C7_02260W_A 176.95500 1.999881 0.2953266 6.771758 1.272266e-11 7.718838e-09
CR_08750C_A 50.61426 1.693394 0.5274584 3.210479 1.325139e-03 2.061440e-02

What I have tried is:

venn.diagram(list(as.character(paste0("Df1 (n=", eval(parse(text="nrow(Df1)")),")"))=row.names(Df1),
                  as.character(paste0("Df2 (n=", eval(parse(text="nrow(Df2)")),")"))=row.names(Df2)),
             fill=c("red", "blue"), height = 5000, width = 5000, resolution = 2000, 
             main = "Title",
             filename="filename.png",  
             imagetype = "png")

but it does not work, with the error :

Error: unexpected '=' in "venn.diagram(list(as.character(paste0("Df1 (n=", eval(parse(text="nrow(Df1)")),")"))=

However, the part as.character(paste0("Df1 (n=", eval(parse(text="nrow(Df1)")),")")) actually produces the label that I need.

Any suggestions are very much appreciated,

EDIT: For some reason I can't add and image to the post. The desired plot should look like this one https://ibb.co/nadGGy (attention to the labels of the circles)

venn.diagram R • 115 views
ADD COMMENTlink modified 4 weeks ago • written 4 weeks ago by grant.hovhannisyan960

Please refer to documentation on how to add manual labels to the venn diagram: https://cran.r-project.org/web/packages/VennDiagram/VennDiagram.pdf

ADD REPLYlink written 4 weeks ago by cpad01128.3k
1

With all respect, I don't think it is constructive to remove the whole correspondence because one can not find the solution to the post.

ADD REPLYlink written 4 weeks ago by grant.hovhannisyan960
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 580 users visited in the last hour