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

Feature request: option to render elements of sets in corresponding Venn diagram regions #41

Open
jimmyocto opened this issue Oct 30, 2018 · 2 comments

Comments

@jimmyocto
Copy link

It would be excellent if venn2 had an option to render Venn diagram regions with elements of the sets instead of the element count.

matplotlib_venn.venn2([set([1, 2, 3, 4, 5, 6, 7]), set([4, 5, 7, 10, 11])])

which produces this
image

Could have an option like this:

matplotlib_venn.venn2([set([1, 2, 3, 4, 5, 6, 7]), set([4, 5, 7, 10, 11])], render_elements=True)

which would instead produce this:

image

@konstantint
Copy link
Owner

You can implement something similar using code shown here:
https://stackoverflow.com/questions/42855256/python-venn-diagram-how-to-show-the-diagram-contents

Laying out text strings appropriately within given geometric regions is not a trivial task to solve, at least if the aim is to solve it in a manner which would be "generally useful", rather than limited to a couple of toy examples (which can be handled with some custom-crafted code like the one above anyway).

Consequently, I'm not sure I, personally, would be looking at this at the moment. I'm not against someone else trying to solve it, though. In this case I don't think the interface should be defined by a render_elements=True function parameter. What would actually be needed is a method of the form

def  spread_texts(path_patch, texts):
     ...

You could then apply it as a kind of post-processing to replace the counts with "spread texts" or whatever else you'd need (the complete post-processing method could be added to the matplotlib_venn.utils package).

@paulbrodersen
Copy link

paulbrodersen commented Apr 30, 2019

I know this issue is old, but you could use my matplotlib-venn-wordcloud to spread the text around in a form filling manner (that's why I wrote that little module to begin with). If that is too quirky, you could align the elements along the midline of each circle segment. The latter approach would only work for venn2 though (IIRC).

wTAwn

Code here.

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

3 participants