matplotlib-venn icon indicating copy to clipboard operation
matplotlib-venn copied to clipboard

Feature request: A way to fix the scale of venn circles

Open beefstew opened this issue 1 year ago • 1 comments

Desired: To have circles representing similar counts appear the same size across plots; this is especially true when creating diagrams with multiple subplots.

Currently, the rendered size of a venn circle is based on the length of the sets that are passed into the venn3 function. Depending on your data, this can cause a circle representing 25 items to appear the same size as one representing 500 items on diagrams that appear next to one another.

Suggestion: add a max_set_size parameter that is used to calculate the scaling factor of drawn circles. Users can easily determine a maximum set size for their data and pass it to each separate venn3 call.

Thanks!

beefstew avatar Sep 09 '24 06:09 beefstew

The pairwise layout algorithm has a normalize_to parameter, which should let you achieve what you need, if I understood it correctly. See if it does. You will need to select different normalizations depending on how you want to scale your diagrams (something like max_set_size_in_diagram/reference_max_set_size) as well as make sure the axes are using the same scale to achieve the effect.

konstantint avatar Sep 09 '24 11:09 konstantint

I can confirm that this does not work: Implemented setting the normalize_to parameter to max_set_size_in_diagram/reference_max_set_size. Results are not correctly scaled, see image:

Image

Marijn-Schipper avatar Mar 11 '25 09:03 Marijn-Schipper

Are you using the same scale on the different axes in your picture? Matplotlib has a tendency to auto-scale the axes and you might want to confirm this (check out xlims and ylims)

konstantint avatar Mar 11 '25 09:03 konstantint

Setting xlims and ylims manually or deactivating autoscaling leads to the same results.

Marijn-Schipper avatar Mar 11 '25 12:03 Marijn-Schipper

It is difficult to assist you without seeing your code.

konstantint avatar Mar 11 '25 21:03 konstantint