LankyCyril / pyvenn

Python module for plotting Venn diagrams of 2..6 sets
https://pypi.org/project/venn
GNU General Public License v3.0
121 stars 27 forks source link

How to use a non-interactive backend? #8

Closed WangSoybean closed 4 years ago

WangSoybean commented 4 years ago

How to use a non-interactive backend?

LankyCyril commented 4 years ago

It's not a pyvenn question per se, but in general with matplotlib-based packages, you can use matplotlib.pyplot.switch_backend():

from matplotlib.pyplot import switch_backend
from venn import venn

switch_backend("Agg")
ax = venn({
    "First": {"A", "B", "C"},
    "Second": {"B", "C", "D", "E"}
})
ax.figure.savefig("test.pdf", bbox_inches="tight")
LankyCyril commented 4 years ago

No follow-up for a month since a solution was posted – assumed resolved, closing it now. If not, ask away!