1

I am plotting a Venn diagram using the function draw.triple.venn() library(VennDiagram). This is my code in R:

g = draw.triple.venn(area1 = 4.1, area2 = 5.6, area3 = 15.9, n12 = 1.3, n23 = 4.2, n13 = 2.3, n123 = 1.2, category = c("Landuse", "Environment", "Space"), fill = c("darkgray", "gray", "lightgrey"), print.mode = c("percent", "percent", "percent"), sigdig=2, ind = T)
grid.arrange(gTree(children=g))

This is the current figure:

enter image description here

Now, I would like to display both 'percentage' and 'raw' for each fraction. In the package description it states: 'print.mode' can be either 'raw' or 'percent'. This is the format that the numbers will be printed in. Can pass in a vector with the second element being printed under the first.

This seems to suggest that both 'raw' and 'percent' can be displayed together. Any suggestions on how to do this?

Also, how can I control that number of digits is used consistently, i.e. have 56.0% (rather than 56%) and 0.5% (rather than 0.53%)? I have set sigdig=2 which I thought would force consistency in that space.

Moreover, is there a way to control the fill colour of each fraction (as compared to only a vector of 3 colours)?

Finally, is there any way to add text manually? I would like to note the proportion of residual variation in the bottom left corner.

This is a link to the package https://cran.r-project.org/web/packages/VennDiagram/VennDiagram.pdf

Any help with this is much appreciated.

tabtimm
  • 411
  • 3
  • 6
  • 17
  • 2
    *Any suggestions on how to do this?* : `print.mode = c("raw", "percent")` seems to work. *Finally, is there any way to add text manually?* : `grid::grid.text("some label", x=0.1, y=0.1)` . *Moreover, is there a way to control the fill colour of each fraction* not easily , I think, but https://stackoverflow.com/questions/43963293/how-to-define-color-of-intersection-in-a-venn-diagram shows one way. – user20650 Oct 17 '17 at 01:45
  • Concerning adding text: did you run the code in the right order? As also mentioned [here](https://stackoverflow.com/questions/20281140/grid-text-and-positioning-in-viewports#20281316), you need to first run `grid.arrange(gTree(children=g))` or whichever way you print the plot, and then run 'grid::grid.text("some label", x=0.1, y=0.1)'. If I run your code, plus the grid.text bit in this way, it nicely shows "some label" in the bottom left corner of the plot. – 4rj4n Oct 17 '17 at 07:59
  • As you have suggested, I had to reverse the order. Thanks for the code and for spotting my error. – tabtimm Oct 17 '17 at 10:40
  • ps... you do not need `grid.arrange(gTree(children=g))`, simply, `grid::grid.draw(g)` will do. (and use `grid::grid.newpage()` for a new plot), although i think triple.venn draws automatically – user20650 Oct 17 '17 at 12:11

1 Answers1

0

Using print.mode = c("raw", "percent") works to include both raw and percent values.

Function grid::grid.text("some label", x=0.1, y=0.1) works to add text manually.

tabtimm
  • 411
  • 3
  • 6
  • 17