本文整理匯總了Python中plot.Plot.set_data方法的典型用法代碼示例。如果您正苦於以下問題:Python Plot.set_data方法的具體用法?Python Plot.set_data怎麽用?Python Plot.set_data使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類plot.Plot
的用法示例。
在下文中一共展示了Plot.set_data方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: Window
# 需要導入模塊: from plot import Plot [as 別名]
# 或者: from plot.Plot import set_data [as 別名]
#.........這裏部分代碼省略.........
self.beta_input.textChanged[str].connect(self.change_argument)
self.update_button.clicked.connect(self.update_animation)
layout = QtGui.QVBoxLayout(self)
splitter1 = QtGui.QSplitter(Qt.Vertical)
splitter1.addWidget(self.lbl1)
splitter1.addWidget(self.acceleration_input)
splitter1.addWidget(self.lbl2)
splitter1.addWidget(self.l1_input)
splitter1.addWidget(self.lbl3)
splitter1.addWidget(self.l2_input)
splitter1.addWidget(self.lbl4)
splitter1.addWidget(self.m1_input)
splitter1.addWidget(self.lbl5)
splitter1.addWidget(self.m2_input)
splitter1.addWidget(self.lbl7)
splitter1.addWidget(self.alpha_input)
splitter1.addWidget(self.lbl8)
splitter1.addWidget(self.beta_input)
splitter1.addWidget(self.lbl6)
splitter1.addWidget(self.r0)
splitter1.addWidget(self.r1)
splitter1.addWidget(self.r2)
splitter1.addWidget(self.r3)
splitter1.addWidget(self.update_button)
# splitter1.addWidget(left)
splitter0 = QtGui.QSplitter(Qt.Horizontal)
splitter0.addWidget(splitter1)
splitter2 = QtGui.QSplitter(Qt.Vertical)
splitter2.addWidget(self.toolbar)
splitter2.addWidget(self.canvas)
splitter0.addWidget(splitter2)
layout.addWidget(splitter0)
self.setLayout(layout)
self.p = Plot(self.figure, self.data)
def init_radio(self):
radio_group = QtGui.QButtonGroup(self.radio_widget)
self.r0 = QtGui.QRadioButton("10s")
self.r1 = QtGui.QRadioButton("25s")
self.r2 = QtGui.QRadioButton("50s")
self.r3 = QtGui.QRadioButton("100s")
radio_group.addButton(self.r0)
radio_group.addButton(self.r1)
radio_group.addButton(self.r2)
radio_group.addButton(self.r3)
self.r0.toggled.connect(self.set_animation_time)
self.r1.toggled.connect(self.set_animation_time)
self.r2.toggled.connect(self.set_animation_time)
self.r3.toggled.connect(self.set_animation_time)
self.r0.toggle()
def set_animation_time(self):
if self.r0.isChecked():
self.animation_time = 10.0
elif self.r1.isChecked():
self.animation_time = 25.0
elif self.r2.isChecked():
self.animation_time = 50.0
elif self.r3.isChecked():
self.animation_time = 100.0
else:
print("Fatal error occured!")
def change_argument(self, text):
try:
argument = float(text)
if self.acceleration_input.senderSignalIndex() > 0:
self.G = argument
elif self.l1_input.senderSignalIndex() > 0:
print(self.L1)
self.L1 = argument
elif self.l2_input.senderSignalIndex() > 0:
self.L2 = argument
elif self.m1_input.senderSignalIndex() > 0:
self.M1 = argument
elif self.m2_input.senderSignalIndex() > 0:
self.M2 = argument
elif self.alpha_input.senderSignalIndex() > 0:
self.alpha = argument
elif self.beta_input.senderSignalIndex() > 0:
self.beta = argument
else:
print("Fatal error occured!")
except:
print("Wrong input")
def update_animation(self):
self.data.set_data(self.G, self.L1, self.L2, self.M1, self.M2, self.alpha, self.beta, self.animation_time)
self.p.set_data(self.data.get_data())
self.p.plot_animation(self.canvas)