Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for label combination 00... #7

Open
nhartwic opened this issue May 16, 2019 · 1 comment
Open

Support for label combination 00... #7

nhartwic opened this issue May 16, 2019 · 1 comment

Comments

@nhartwic
Copy link

nhartwic commented May 16, 2019

I'm sure there is probably a way to do it using some combination of pyplot commands, but given this comes up quite a bit for venn diagrams, it would be nice if there was a clean way to specify labels and counts for the null-combination of classes. For example, the venn2 function should be able to cleanly handle input like...

labels = {"00": 2, "01": 5, "10": 5, "11": 10}
fig, ax = venn.venn2(labels, names=['list 1', 'list 2'])

and it should document the fact that their are 2 data points that aren't in list 1 or list 2 somewhere on the resultant figure. For now my easiest sollution to this is to just use pyplot.text and manually create the label for the category, but this is clunky. Another arguably less clunky sollution is to create the null category as a new label type and do something like...

labels = {"001": 2, "010": 5, "100": 5, "110": 10}
fig, ax = venn.venn3(labels, names=['list 1', 'list 2', "neither"])

I don't like this sollution though as it adds a false dimension to the data creating lots of positions where it seems like a count should exist but doesn't. ("111" for example)

The ideal sollution would both add the label for the 00* category to the legend and provide the ability to label the whitespace with the relevant count and name. This would probably require adding a keyword argument to the vennK functions to make them into something like.

def venn2(labels, names=['A', 'B'], null_name="None", **options):

EDIT: Played with it some more. Here is a way to add "null" labels to venn diagrams at the moment for anyone reading this. Would be nice if something like this became default behavior though or could easily be done through the use of an optional argument like "null_name" above

# names = some list of label names
# labels = dict mapping label combinations to counts as usual
fig, ax = venn2(labels, names)

# remake legend with null label
ax.plot([], color="white")
legend_null_label = "neither : 2"
ax.legend( [legend_null_label] + names, loc='center left', bbox_to_anchor=(1.0, 0.5), fancybox=True)

# optionally add the information somewhere on the figure
ax.text(0.95, 0.4, legend_null_label)
@osp-ng
Copy link
Contributor

osp-ng commented Jul 19, 2019

This issue asks to add a "complement set" to Venn diagrams.

Check wikipedia

Please send your pull request.

@tctianchi tctianchi mentioned this issue Jun 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants