konstantint / matplotlib-venn

Area-weighted venn-diagrams for Python/matplotlib
MIT License
496 stars 67 forks source link

venn3 center circle left as white space for very small intersections #12

Closed mswestphal closed 9 years ago

mswestphal commented 10 years ago

When intersecting three large datasets that have a very small intersection, the center circle is left as white space, although it has a value. I'm not sure if this is a bug or just a plotting limitation. I'm going to try re-plotting with unweighted circles in the meantime.

See this image for the values I'm using: http://imgur.com/DWhS8e4

konstantint commented 9 years ago

Hi, this problem is more or less unfixable in general. A Venn diagram has 6 degrees of freedom (e.g. positions and sizes of the second and third circle with respect to the first one). The data you use to construct it, has 7 numbers though, therefore there may always be a discrepancy between the region areas and the data you provide.

In my implementation, the circles are positioned to ensure that the full circle areas and pairwise circle intersection areas correspond to the data. The actual subset regions then end up whatever they end up, which may sometimes result in problems like yours. I do not believe any alternative positioning method would help in general - one can always come up with some weird counter-examples, hence I won't be fixing this issue now (unless someone comes up with some cool solution).

In your particular example, you could use a hack and manually force the central region to be present by doing something like that:

 v = venn3((75566, 53950, 811, 39228, 7207, 811, 10000))
 v.get_label_by_id('111').set_text('127')

(Sorry for a late reply, I actually managed to somehow miss this issue completely)