from matplotlib.figure import Figure
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
figure = Figure()
canvas = FigureCanvas(figure)
axes = figure.add_subplot(1, 1, 1, axisbg='red')
axes.plot([1, 2, 3])
canvas.print_figure('red-bg.png')
How to change plot background color?