konstantint / matplotlib-venn

Area-weighted venn-diagrams for Python/matplotlib
MIT License
519 stars 68 forks source link

Add parameter to allow formatting of labels of subset sizes #28

Closed burritothief closed 7 years ago

burritothief commented 7 years ago

I'm using your library to compare sets with very large numbers (numbers are also dollar numbers) so I want the venn diagram to display as something nicer like $1.3MM instead of 1301304.

This pull request adds an additional argument to venn2 and venn3 that is a function that will take the subset size as a parameter and return a formatted string.

konstantint commented 7 years ago

Oh, I was delaying with this function because I was reluctant to decide whether I want to implement it as you did, via adding parameters, or make it part of the Venn class (e.g. v.format_subset_labels(f)). The latter solution is structurally a bit nicer because allows to modify the diagram later and does not require to remember about the formatter parameter in, say, venn_unweighted functions. On the other hand, the former is more familiar.

Let's say your PR resolves the uncertainty now and we'll go with this option :)