Transparent background with matplotlib and tkinter

Viewed 103

I'm programming a data-analysis programm for whatsapp chats and I have a matplotlib graph in my tkinter window. I know how to customize colors, but how do I set the background to transparent?

f = Figure(figsize=(4.1, 4.1), dpi=100)                                        
f.set_facecolor('xkcd:gray')                   # this should be transparent
a = f.add_subplot(111)
a.plot(dates, mes_count)
a.xaxis.set_major_locator(MaxNLocator(prune='both',nbins=6))
a.set_facecolor('xkcd:gray')

canvas = FigureCanvasTkAgg(f, mainloop.root)                                    
canvas.get_tk_widget().place(x=190, y=80)
0 Answers
Related