Change background colour of Venn diagram

logo of a chart:Venn

This post aims to show how to change the background color of a basic venn diagram using matplotlib library.

You can change the background color of a basic venn diagram using the set_facecolor() function of matplotlib.

# Library
from matplotlib import pyplot as plt
from matplotlib_venn import venn2
 
# Basic Venn
v = venn2( (10, 20, 10), alpha = 1 )
 
# Change Backgroud
plt.gca().set_facecolor('skyblue')
plt.gca().set_axis_on()
 
# Show it
plt.show()

Contact & Edit


👋 This document is a work by Yan Holtz. You can contribute on github, send me a feedback on twitter or subscribe to the newsletter to know when new examples are published! 🔥

This page is just a jupyter notebook, you can edit it here. Please help me making this website better 🙏!