相关疑难解决方法(0)

我如何告诉Matplotlib创建第二个(新)情节,然后在旧照片上绘图?

我想绘制数据,然后创建一个新的数字和绘制数据2,最后回到原始绘图和绘图data3,有点像这样:

import numpy as np
import matplotlib as plt

x = arange(5)
y = np.exp(5)
plt.figure()
plt.plot(x, y)

z = np.sin(x)
plt.figure()
plt.plot(x, z)

w = np.cos(x)
plt.figure("""first figure""") # Here's the part I need
plt.plot(x, w)
Run Code Online (Sandbox Code Playgroud)

仅供参考我如何告诉matplotlib我已经完成了一个情节?做类似的事情,但并不完全!它不允许我访问原始情节.

python plot matplotlib figure

123
推荐指数
4
解决办法
28万
查看次数

plt.close()和plt.clf()之间的区别

在Python中,plt.clf()和之间有什么区别plt.close()

他们会以同样的方式运作吗?

python matplotlib

22
推荐指数
2
解决办法
3万
查看次数

如何清除 PyQt 中的情节?

我使用 QT Designer 在 PyQt 中创建了一个小应用程序。我有一些按钮,“绘图”按钮在 4 个不同的小部件上创建 4 个绘图。“清除”按钮必须清除这 4 个图。我尝试编写一些代码,但它没有运行。如何创建这个清除按钮?谢谢你。

这是我的应用程序的主要内容:

import sys
from Import_fsa import import_fsa
from PyQt4 import QtCore, QtGui
from PyQt4.QtGui import QFileDialog
from Vannucci_Gemignani import Ui_MainWindow


class GUI_fsa(QtGui.QMainWindow):
    def __init__(self):

        QtGui.QMainWindow.__init__(self)
        self.ui=Ui_MainWindow()
        self.ui.setupUi(self)

        self.ui.Button_Browse.clicked.connect(self.Browse)
        self.ui.Button_Plot.clicked.connect(self.Plot)
        self.ui.Button_Clear.clicked.connect(self.Clear)

    def Browse(self):

        fname=QFileDialog.getOpenFileName()
        if fname=='':  #se non viene selezionato nessun file, fname è
            return     #nullo, generando quindi un errore nell'import fsa

        self.ui.lineEdit.setText(fname)




    def Plot(self):
        if self.ui.lineEdit.text()=='':
            QtGui.QMessageBox.information(None,'Warning','Select fsa File',QtGui.QMessageBox.Ok)
            return

        data_set=import_fsa(self.ui.lineEdit.text())        

        self.ui.widget.canvas.ax.clear()
        self.ui.widget_2.canvas.ax.clear()
        self.ui.widget_3.canvas.ax.clear()
        self.ui.widget_4.canvas.ax.clear()

        self.ui.widget.canvas.ax.plot(data_set[0])
        self.ui.widget_2.canvas.ax.plot(data_set[1])
        self.ui.widget_3.canvas.ax.plot(data_set[2]) …
Run Code Online (Sandbox Code Playgroud)

python plot qt pyqt4

1
推荐指数
1
解决办法
9384
查看次数

标签 统计

python ×3

matplotlib ×2

plot ×2

figure ×1

pyqt4 ×1

qt ×1