微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

带有 matplotlib 和 tkinter 的透明背景

如何解决带有 matplotlib 和 tkinter 的透明背景

我正在为 whatsapp 聊天编写数据分析程序,我的 tkinter 窗口中有一个 matplotlib 图。我知道如何自定义颜色,但如何将背景设置为透明?

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)

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。