Skip to main content

YAMVP - Yet Another Matplotlib Venn-diagram Plotter

Project description

Python 3x pypi

YAMVP - Yet Another Matplotlib Venn-diagram Plotter

Overview

This module provides a function to create matplotlib figures containing ellipse-based Venn-diagramms with up to 5 Classes.

The main goal was to provide a simple interface, and good looks.

Class colors are averaged instead of simply using alpha, making the intersection colors invariant to the order of the ellipses drawn.

Installation

pip install yamvp

Basic usage

from yamvp import venn
import numpy as np

#Fill a 4-dim 2x2x2x2 array with random values
rand4 = np.random.randint(0, 1000, size=(2, 2, 2, 2))
    
#Set the value at A∩C to 42
rand4[1,0,1,0] = 42

#Create the Venn-diagram
fig = venn(rand4, ["A", "B", "C", "D"])

#save the figure
fig.savefig("rand4_demo.png", dpi=100, bbox_inches="tight")
plt.close(fig)

rand4_demo

n=1

venn([None, "A"], ["Alpha"], outfile = "venn1_demo.png")

venn1_demo

n=2

venn([[None, "B"], ["A", "AB"]], ["Alpha", "Beta"], outfile = "venn2_demo.png")

venn2_demo

n=3

vals3 = [
    [[None, "C"], ["B", "BC"]],
    [["A", "AC"], ["AB", "ABC"]],
]
venn(vals3, ["Alpha", "Beta", "Gamma"], outfile = "venn3_demo.png")

venn3_demo

n=4

vals4 = np.empty((2, 2, 2, 2), dtype=object)
for i, yA in enumerate(("", "A")):
    for j, yB in enumerate(("", "B")):
        for k, yC in enumerate(("", "C")):
            for l, yD in enumerate(("", "D")):
                vals4[i, j, k, l] = yA + yB + yC + yD
vals4[0,0,0,0] = None

venn(vals4, ["Alpha", "Beta", "Gamma", "Delta"], outfile = "venn4_demo.png")

venn4_demo

n=5

vals5 = np.empty((2, 2, 2, 2, 2), dtype=object)
for i, yA in enumerate(("", "A")):
    for j, yB in enumerate(("", "B")):
        for k, yC in enumerate(("", "C")):
            for l, yD in enumerate(("", "D")):
                for m, yE in enumerate(("", "E")):
                    vals5[i, j, k, l, m] = yA + yB + yC + yD + yE
vals5[0,0,0,0,0] = None

venn(vals5, ["Alpha", "Beta", "Gamma", "Delta", "Epsilon"], outfile = "venn5_demo.png")

venn5_demo

Custom colors

venn(vals4, ["Alpha", "Beta", "Gamma", "Delta"], colors=["red", "green", "blue", "yellow"], outfile = "venn4_demo_colors.png")

venn4_demo_colors

License

This project is licensed under the MIT License (c) 2025 Bálint Csanády, aielte-research. See the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

yamvp-0.1.tar.gz (14.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

yamvp-0.1-py3-none-any.whl (13.4 kB view details)

Uploaded Python 3

File details

Details for the file yamvp-0.1.tar.gz.

File metadata

  • Download URL: yamvp-0.1.tar.gz
  • Upload date:
  • Size: 14.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for yamvp-0.1.tar.gz
Algorithm Hash digest
SHA256 4d10b0542084a7375fa1d6e4ffe191d2120d579b54d02d8f4295bf7c8db3c53a
MD5 1f33c56cc88cd121fff55301e8a4d5b1
BLAKE2b-256 b1e759cb3e7a6aed53e7a887402b5a556bbce9ed132e86d07ac7f1758c963bcb

See more details on using hashes here.

File details

Details for the file yamvp-0.1-py3-none-any.whl.

File metadata

  • Download URL: yamvp-0.1-py3-none-any.whl
  • Upload date:
  • Size: 13.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for yamvp-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a900a72bdeb2bd7fe6e17f3577511c0a9a9f929490d5d1ca27d89e8d45b15add
MD5 6a5f523004704aa0377ffcb991ac8c7d
BLAKE2b-256 c4930853da388e3a135d49e30d9a17135b61e02dad1dc975b7c30b27e39dfce2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page