Closed nesilin closed 7 years ago
The layout algorithm is not perfect and there may be rare corner cases where it fails to layout the regions. You should be able to see how the circles should look like using the venn3_circles
method (which only plots the circles, without going through the steps of splitting them into regions).
It would be nice if you could provide the actual subset sizes which lead to this error. Try calling
matplotlib_venn._venn3.compute_venn3_subsets(a,b,c)
(where a,b,c are your three sets) and posting the resulting 7-number tuple here.
Hi!
I 'm generating different venn3 plots. For the cases where the 7 numbers ([Abc, aBc, ABc, abC, AbC, aBC, ABC]) looks like that:
CASE A: (1, 0, 0, 32, 0, 76, 13) It gives the attached plot but python warns about a BadCirclePositioning: warning:
/home/isentis/anaconda3/lib/python3.5/site-packages/matplotlib_venn/_venn3.py:117: UserWarning: Bad circle positioning
warnings.warn("Bad circle positioning")
CASE B However, when now C is bigger and contains all A and B it gives the error
VennRegionException: Invalid configuration of circular regions (holes are not supported).
and its 7 position-numbers and venn3_circles plot look like that: (1, 0, 0, 650, 0, 76, 13)
Ugh. As I said these are the ugly corner cases which the current layout algorithm does not handle well, and I do not know a simple solution which would not involve complicated geometry, hacks or optimization solving.
As a hack in your particular case you could simply tune some of the zero regions slightly - this usually fixes such problems. I understand this is ugly if you need to generate many diagrams programmatically, but I don't know any other immediate fixes at the moment. E.g.
v = venn3((1, 0.1, 0, 650, 0, 76, 13))
v.get_label_by_id('010').set_text('')
Thanks for finding this example.
Thanks for the reply!
I'll keep the issue open. The problem is still a bug and deserves fixing one day.
Hi, Konstantin! I guess I have somewhat similar issue. I am plotting using genomic data and sometimes getting output like this: What 'hack' can I use to get rid of little green triangle in the bottom? The numbers were: 7549417, 15685620, 26018311, 5128906, 301048, 6841264, 2762301
What you want to do is to "pull" the size of the set A&B&~C larger - this will force the diagram to have enough weight there to not be lost in the scaling.
There is a special method venn3_unweighted
which lets you specify set weights used to position the circles separately from the numbers displayed on them.
Namely, try this:
sets = (7549417, 15685620, 26018311, 5128906, 301048, 6841264, 2762301)
venn3_unweighted(sets,
subset_areas=(7549417, 15685620, 26018311, 5128906, 10*301048, 6841264, 2762301),
subset_label_formatter=lambda x: '%0.2f%%' % (100*x/sum(sets)))
(Note that I'm getting different percentages from your picture)
Thank you very much! You shouldn't worry about the percentages because they represent something different, each of the circles represent length of protein-dna interaction domains, and intersections show domains which are common for given 2 or 3 proteins.
I reformulated the issue into a proper task, addressing it (#35). Let's call it "progress" :)
Hi!
I'm using venn3 to plot 3 sets of names and the following exception appeared:
I can't figure out what is exactly going on and whether there is something I can do to solve it. I bit of help would be appreciated. Thanks!