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()

🚨 Grab the Data To Viz poster!


Do you know all the chart types? Do you know which one you should pick? I made a decision tree that answers those questions. You can download it for free!

    dataviz decision tree poster