matplotlib和pyqt4透明背景

时间:2015-04-24 19:21:50

标签: python matplotlib pyqt pyqt4

对于我的应用,我尝试将matplotlib与PyQt4一起使用。我试图使matplotlib数字的背景透明,如Matplotlib / PyQT4: transparent figure 但结果如下:

enter image description here,背景是这样的:

enter image description here

就像背景在matplotlib图中重新缩放,或者PyQT4中QWidget的背景的一部分被复制到另一个地方。 很难使代码变短。我将从1个图中取1个例子:

 class MyMplCanvas(FigureCanvas):
     """Ultimately, this is a QWidget (as well as a FigureCanvasAgg)."""
     def __init__(self, parent=None):
         fig = Figure(facecolor='None',edgecolor='None')
         self.axes = fig.add_subplot(111,autoscale_on=False,axisbg='none')
         self.fig.patch.set_alpha(0)

其余代码基于Matplotlib上的示例 http://matplotlib.org/examples/user_interfaces/embedding_in_qt4.html

我无法解决这个问题。那么是否可以使背景真正透明?

0 个答案:

没有答案