Normally, Matplotlib plots and figures have a white background by default, which can be changed to any color we want using the facecolor argument. If we have to embed these figures in any to any other application, this background color will carry forward. However, the Matplotlib savefig() method gives an option to save figures without this background color, using a transparent argument. In this recipe, we will learn how to use this option.
Managing transparency for web applications
Getting ready
We will plot four graphs, save them with the normal mode and the transparent option, and embed them in to HTML pages to see how different they look.
Import the required libraries:
import matplotlib.pyplot as plt
import numpy as np
import...