本文整理汇总了Python中matplotlib.backends.backend_gtkagg.FigureCanvasGTKAgg.draw_idle方法的典型用法代码示例。如果您正苦于以下问题:Python FigureCanvasGTKAgg.draw_idle方法的具体用法?Python FigureCanvasGTKAgg.draw_idle怎么用?Python FigureCanvasGTKAgg.draw_idle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.backends.backend_gtkagg.FigureCanvasGTKAgg
的用法示例。
在下文中一共展示了FigureCanvasGTKAgg.draw_idle方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: If_running
# 需要导入模块: from matplotlib.backends.backend_gtkagg import FigureCanvasGTKAgg [as 别名]
# 或者: from matplotlib.backends.backend_gtkagg.FigureCanvasGTKAgg import draw_idle [as 别名]
#.........这里部分代码省略.........
filter.add_pattern("*.csv")
dialog.add_filter(filter)
dialog.set_filter(filter)
#dialog = gtk.FileChooserDialog("Please choose a file", self,
#gtk.FileChooserAction.OPEN,
#(gtk.STOCK_CANCEL, gtk.ResponseType.CANCEL,
#gtk.STOCK_OPEN, gtk.ResponseType.OK))
response = dialog.run()
if response == gtk.RESPONSE_OK:
#print("Open clicked")
#print("File selected: " + dialog.get_filename())
self.open_file(dialog.get_filename())
#elif response == gtk.RESPONSE_CANCEL:
#print("Cancel clicked")
dialog.destroy()
def Run(self, widget=None, data=None):
#self.som.ticks += self.iterations_spin_button.get_value_as_int()
if not self.som.running:
### Initialization and training ###
#self.som = MiniSom(5, 15, 8,sigma=1.2,learning_rate=0.5)
#self.init_som()
for i in range(1):
self.train_som()
#self.figure.clf()
self.Draw_figure()
self.canvas.draw()
self.canvas.draw_idle()
#We need to draw *and* flush
self.figure.canvas.draw()
self.figure.canvas.flush_events()
#print "draw"
self.update_treeview(self.test_data, self.test_liststore)
self.update_treeview(self.data, self.patterns_liststore)
glib.idle_add(self.Status_update)
glib.idle_add(self.If_running)
glib.idle_add(self.If_paused)
def Test(self, widget=None, data=None):
#self.som.ticks += self.iterations_spin_button.get_value_as_int()
if not self.som.running:
### Initialization and training ###
#self.som = MiniSom(5, 15, 8,sigma=1.2,learning_rate=0.5)
self.test_som()
#self.figure.clf()
self.Draw_figure()
self.canvas.draw()
self.canvas.draw_idle()
#We need to draw *and* flush
self.figure.canvas.draw()
self.figure.canvas.flush_events()
#print "draw"
glib.idle_add(self.Status_update)
示例2: Panoptikum
# 需要导入模块: from matplotlib.backends.backend_gtkagg import FigureCanvasGTKAgg [as 别名]
# 或者: from matplotlib.backends.backend_gtkagg.FigureCanvasGTKAgg import draw_idle [as 别名]
#.........这里部分代码省略.........
data["posh"] * p["pixelSize"] * p["axScale"] + ImageScale[2],
],
p["linescanAx"].get_ylim(),
"k:",
)
posVrelAxH = (data["posv"] * p["pixelSize"] * p["axScale"]) / (ImageScale[1] - ImageScale[0]) * (
ImageScale[3] - ImageScale[2]
) + ImageScale[2]
p["linescanAx"].plot([posVrelAxH, posVrelAxH], p["linescanAx"].get_ylim(), ":", color="0.5")
p["linescanAx"].plot([p["Marker1Pos"][0], p["Marker1Pos"][0]], p["linescanAx"].get_ylim(), "k-")
posVrelAxHMarker1 = (p["Marker1Pos"][1] - ImageScale[0]) / (ImageScale[1] - ImageScale[0]) * (
ImageScale[3] - ImageScale[2]
) + ImageScale[2]
p["linescanAx"].plot([posVrelAxHMarker1, posVrelAxHMarker1], p["linescanAx"].get_ylim(), "-", color="0.85")
p["linescanAx"].text(
0.02, 0.05, u"TOF = {:.2f}ms".format(data["abb_tof"] / 1e3), transform=p["linescanAx"].transAxes
)
if not data["automatisierung"] == 0:
p["linescanAx"].text(
0.98,
0.05,
u"auto: {:.0f}/{:.0f} #{:.0f}".format(
data["auto_step_pos"], abs(data["auto_break"]), data["auto_n_pos"]
),
transform=p["linescanAx"].transAxes,
horizontalalignment="right",
)
p["linescanAx"].set_xlim((ImageScale[2], ImageScale[3]))
p["linescanAx"].grid(True, color="0.5")
p["linescanAx"].set_xlabel(u"\u00b5m")
p["linescanAx"].ticklabel_format(style="sci", axis="y", scilimits=(0, 3))
title3.set_fontsize(18)
title3.set_y(1.06)
p["canvasObj"].draw_idle()
return data
def updateADwinID(self, parameters):
p = parameters
if not self.live_mode_check_button.get_active():
ID = float(p["adwinID"].get_value())
else:
with open(p["adwinfile"] + ".id") as adwinIDfile:
ID = float(adwinIDfile.read())
p["adwinID"].set_range(0, 1e6)
p["adwinID"].set_value(ID)
def updateFullFrameImage(self, parameters):
p = parameters
if p["imageCategory"] == "ROI":
p["fullFrame"] = apogee.singleImage(p["filenames"][0], self.maxImageSize)
x, y = shape(p["fullFrame"])
p["part"] = array([0, x, 0, y])
else:
p["fullFrame"] = apogee.odTriple(p["filenames"], self.maxImageSize, p["partLumCorr"], p["partAtomCount"])
self.updateADwinID(parameters)
def drawCrosshair(self, line1, line2, position):
line1.set_ydata(position[1])
line2.set_xdata(position[0])
def on_togglebuttonLiHide_toggled(self, button):
if button.get_active():
self.hbox_Li.hide()
else:
self.hbox_Li.show()
示例3: Figure
# 需要导入模块: from matplotlib.backends.backend_gtkagg import FigureCanvasGTKAgg [as 别名]
# 或者: from matplotlib.backends.backend_gtkagg.FigureCanvasGTKAgg import draw_idle [as 别名]
#.........这里部分代码省略.........
# Coordinates to place label (on top set of axes)
xloc,yloc=top_ax.transData.inverted().transform((xsel,ysel))
# Label the point
if (xloc > sum(self.ax.get_xlim())/2): h_align='right'
else: h_align='left'
self.label_text=\
top_ax.text(xloc,yloc,'({0:.3g},{1:.3g})'\
.format(xlabel,ylabel),\
backgroundcolor='white', color=label_color,\
verticalalignment='bottom', horizontalalignment=h_align,\
bbox={'facecolor': 'white', 'boxstyle':
'round'},zorder=100 )
self.label_point,=\
top_ax.plot(xloc,yloc,'ro',\
zorder=self.label_text.get_zorder()+1)
self.repaint()
# Otherwise, just clear off old labels
else:
self.label_text.remove()
self.label_point.remove()
del(self.label_text)
self.repaint()
def replot(self):
if self.mode == TWODPLOT:
self.ax.clear()
self.ax.plot(self.listing.getX(),self.listing.getY(1),self.color1+'.-')
self.count_since_replot=0
elif self.mode == DUALTWODPLOT:
self.ax.clear()
self.ax2.clear()
self.ax.plot(self.listing.getX(),self.listing.getY(1),self.color1+'.-')
self.ax2.plot(self.listing.getX(),self.listing.getY(2),self.color2+'.-')
self.count_since_replot=0
def show(self):
try:
if not self.packed:
self.pack_start(self.canvas, expand=True)
toolbar = NavigationToolbar(self.canvas, self.get_parent_window())
next = 8
button = gtk.Button('Lin y')
button.show()
button2 = gtk.Button('Lin x')
button2.show()
# linear/log
def clicked(button):
self.adjust_axis_margins()
self.set_axis_labels()
self.color_labels()
self.canvas.draw_idle()
self.canvas.show()
if self.ax.get_yscale() == 'log':
button.set_label('Lin y')
self.ax.set_yscale('linear')
else:
button.set_label('Log y')
self.ax.set_yscale('log')
self.show()
def clicked2(button):
self.adjust_axis_margins()
self.set_axis_labels()
self.color_labels()
self.canvas.draw_idle()
self.canvas.show()
if self.ax.get_xscale() == 'log':
button.set_label('Lin x')
self.ax.set_xscale('linear')
else:
button.set_label('Log x')
self.ax.set_xscale('log')
self.show()
button.connect('clicked', clicked)
button2.connect('clicked', clicked2)
toolitem=gtk.ToolItem()
toolitem.show()
toolitem.add(button)
toolbar.insert(toolitem, next)
next +=1
toolitem2=gtk.ToolItem()
toolitem2.show()
toolitem2.add(button2)
toolbar.insert(toolitem2, next)
self.pack_start(toolbar, expand=False)
self.packed = True
super(Figure, self).show()
except Exception, e:
print 'Exception: ', e
raise