jolars / eulerr

Area-Proportional Euler and Venn Diagrams with Ellipses
https://jolars.github.io/eulerr/
GNU General Public License v3.0
130 stars 18 forks source link

plot number of items that lie outside the euler diagram #13

Open Gian77 opened 7 years ago

Gian77 commented 7 years ago

Hello, thank you so much for the nice Euler diagram implementation in R. I only have one question for you. I was looking at the plot.euler page and I wasn't able to find a way to plot a number outside the circles representing the items that are "outside" the euler diagrams and not belong to those grouping variables. Is there a way to do it? Thanks a lot, Gian

jolars commented 7 years ago

Unfortunately there is no such argument, though I am not convinced there should be. I would argue that it's the intersections that are of interest in a Euler diagram and not the complement to those intersections. However, if you think otherwise I'm sure I could be persuaded.

In any case, it is very easy to fix this yourself. You could do one of the following two:

library(eulerr)
library(lattice)
library(latticeExtra)

plot(euler(c(A = 25, B = 25))) +
        layer(panel.key("n = 10", points = FALSE))

plot(euler(c(A = 25, B = 25, "NOT A, NOT C" = 10)))
Gian77 commented 7 years ago

Hello @jolars thanks a lot, it looks like it worked :+1:

plot(euler(c("A" = 39, "B" = 202, "A&B"=46), labels = c("A","B")), fill_opacity = , fill=c("#33A02C","#1F78B4"), lty=0, fontface = 0, counts=TRUE, main="(A)") + layer(panel.key("n = 16", points = FALSE))

eurl

jolars commented 6 years ago

I have given this thought and I do not think that I will support this since a principal feature of the diagrams is that the shapes are area-proportional and this is already a possibility by specifying a set that contains the other sets, like this (using ellipses):

plot(euler(c(C = 16, "A&C" = 39, "B&C" = 202, "A&B&C"=46), shape = "ellipse"))

image

Not perfect, but at least it maintains area-proportionality.

mkschneider commented 5 years ago

First of all thanks for this great package. I am reopening the issue because I have a related question. Euler diagrams can be used to display the percentage of of explained variance due to various components. This is then a share of the total variance. Often the total is drawn as a box around the euler diagram and the size of the circles are scaled proportional to the proportions explained. Can this be achieved using eulerr?

jolars commented 5 years ago

Unfortunately not @mkschneider. This would be difficult to achieve while still maintaining proportionality of the diagrams. I am open to pull requests addressing the issue but will not work on it myself. I'll reopen the issue, however.