本文整理汇总了Python中pylab.get_current_fig_manager函数的典型用法代码示例。如果您正苦于以下问题:Python get_current_fig_manager函数的具体用法?Python get_current_fig_manager怎么用?Python get_current_fig_manager使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_current_fig_manager函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: onpick
def onpick(self,event):
if event.mouseevent.button==3 and not self.shift_is_held and pyl.get_current_fig_manager().toolbar._active==None:
for ii in range(len(self.patchList)):
if event.artist==self.patchList[ii]:
k=ii
break
self.remPatch(k)
#self.patchList[k].remove()
pyl.draw()
elif event.mouseevent.button==1 and self.shift_is_held and pyl.get_current_fig_manager().toolbar._active==None:
for ii in range(len(self.patchList)):
if event.artist==self.patchList[ii]:
k=ii
break
self.press=(self.patchList[k].center[0],self.patchList[k].center[1],event.mouseevent.xdata,event.mouseevent.ydata,k,self.patchList[k].height,1)
elif event.mouseevent.button==1 and self.ctrl_is_held and pyl.get_current_fig_manager().toolbar._active==None:
for ii in range(len(self.patchList)):
if event.artist==self.patchList[ii]:
k=ii
break
self.press=(self.patchList[k].center[0],self.patchList[k].center[1],event.mouseevent.xdata,event.mouseevent.ydata,k,self.patchList[k].height,3)
示例2: zoom_selected
def zoom_selected(self, event):
"""zoom currently selected area"""
current_area = self.get_current_area(event)
pylab.get_current_fig_manager().toolbar.push_current()
pylab.gca().set_xlim(current_area[0][0], current_area[1][0])
pylab.gca().set_ylim(current_area[0][1], current_area[1][1])
pylab.get_current_fig_manager().toolbar.draw()
示例3: drawModel
def drawModel(self):
if self.modelFigure == None or self.modelFigure.canvas.manager.window == None:
self.modelFigure = PL.figure()
PL.get_current_fig_manager().window.geometry("+420+30")
self.modelFigure.canvas.set_window_title(self.titleText)
PL.ion()
self.modelDrawFunc()
self.modelFigure.canvas.manager.window.update()
示例4: plot
def plot(arg):
update_values(arg)
axis=pylab.arange(len(pitch_value)-max_plot,len(pitch_value),1)
pitch_acc_graph[0].set_data(axis,pylab.array(pitch_acc_value[-max_plot:]))
pitch_rot_graph[0].set_data(axis,pylab.array(pitch_rot_value[-max_plot:]))
pitch_graph[0].set_data(axis,pylab.array(pitch_value[-max_plot:]))
ax.axis([axis.min(),axis.max(),min_y,max_y])
pylab.get_current_fig_manager().canvas.draw()
示例5: set_figure_size_and_location
def set_figure_size_and_location(x=50,y=50,width=400,height=400):
if matplotlib_backend in ['WX','WXAgg']:
thismanager = get_current_fig_manager()
thismanager.window.SetPosition((x, y))
thismanager.window.SetSize((width,height))
elif matplotlib_backend in ['Qt4Agg','Qt5Agg']:
thismanager = get_current_fig_manager()
thismanager.window.setGeometry(x,y,width,height)
else:
raise NotImplementedError(matplotlib_backend)
示例6: keypress
def keypress(event):
"""
Handle key shortcut in a window
called from: click, display
input: event structure
output: None
"""
from pylab import close,gcf,figure,gca,text,title,show
event.key = event.key.lower()
if event.key == 'q':
close('all')
elif event.key == 'x':
close('all')
elif event.key == 'p':
dumpfile('ps')
elif event.key == 'd':
dumpfile('pdf')
elif event.key == 'n':
dumpfile('png')
elif event.key == 'j':
dumpfile('jpg')
elif event.key == 'o' or event.key == 'l':
'toggle lin/log'
from pylab import get_current_fig_manager
tb = get_current_fig_manager().toolbar
options.log = not options.log;
if options.log == True:
tb.set_message('Log intensity scale selected for next plots');
else:
tb.set_message('Linear intensity scale selected for next plots');
elif event.key == 'c':
'toggle contour/normal'
from pylab import get_current_fig_manager
tb = get_current_fig_manager().toolbar
options.contour = not options.contour;
if options.contour == True:
tb.set_message('Contour mode selected for next 2D plots');
else:
tb.set_message('Normal mode selected for next 2D plots');
elif event.key == 'h':
'usage/help'
h=figure()
text(0.05,0.05,usage)
title(os.path.basename(sys.argv[0]) + ": plotting tool for McCode data set",fontweight='bold')
show()
elif event.key == 'right' or event.key == 'pagedown':
'show next scan step/monitor'
display_scanstep(File, +1)
elif event.key == 'left' or event.key == 'backspace' or event.key == 'pageup':
'show previous scan step/monitor'
display_scanstep(File, -1)
示例7: plot
def plot(arg):
update_values(arg)
axis=pylab.arange(len(accx_value)-max_plot,len(accx_value),1)
accx_graph[0].set_data(axis,pylab.array(accx_value[-max_plot:]))
accy_graph[0].set_data(axis,pylab.array(accy_value[-max_plot:]))
accz_graph[0].set_data(axis,pylab.array(accz_value[-max_plot:]))
rotx_graph[0].set_data(axis,pylab.array(rotx_value[-max_plot:]))
roty_graph[0].set_data(axis,pylab.array(roty_value[-max_plot:]))
rotz_graph[0].set_data(axis,pylab.array(rotz_value[-max_plot:]))
ax.axis([axis.min(),axis.max(),min_y,max_y])
pylab.get_current_fig_manager().canvas.draw()
示例8: refresh_raster_plot
def refresh_raster_plot(clk):
if matplotlib.is_interactive():
if myopts["showlast"] is None:
st, sn, nmax = get_plot_coords()
line.set_xdata(st)
line.set_ydata(sn)
ax.set_xlim(0, amax(st))
else:
st, sn, nmax = get_plot_coords(clk._t - float(myopts["showlast"]), clk._t)
ax.set_xlim((clk.t - myopts["showlast"]) / ms, clk.t / ms)
line.set_xdata(array(st))
line.set_ydata(sn)
if myopts["redraw"]:
pylab.draw()
pylab.get_current_fig_manager().canvas.flush_events()
示例9: __init__
def __init__(self):
self.win = gtk.Window()
#win.connect("destroy", lambda x: gtk.main_quit())
self.win.connect("delete-event", self.hideinsteadofdelete)
self.win.set_default_size(400,300)
self.win.set_title("Embedding in GTK")
vbox = gtk.VBox()
self.win.add(vbox)
self.f = Figure(figsize=(5,4), dpi=100)
sw = gtk.ScrolledWindow()
vbox.pack_start(sw)
#self.win.add (sw)
# A scrolled window border goes outside the scrollbars and viewport
sw.set_border_width (10)
# policy: ALWAYS, AUTOMATIC, NEVER
sw.set_policy (hscrollbar_policy=gtk.POLICY_AUTOMATIC,
vscrollbar_policy=gtk.POLICY_ALWAYS)
self.canvas = FigureCanvas(self.f) # a gtk.DrawingArea
#vbox.pack_start(canvas)
self.canvas.set_size_request(300,200)
sw.add_with_viewport (self.canvas)
manager = get_current_fig_manager()
# you can also access the window or vbox attributes this way
toolbar = manager.toolbar
#vbox.pack_start(canvas)
toolbar = NavigationToolbar(self.canvas, self.win)
vbox.pack_start(toolbar, False, False)
self.win.show_all()
示例10: chargingRatePlot
def chargingRatePlot(filePath='/tmp/some.file', plotLabel = 'New Plot'):
'''
Plots a graph A(t)
where:
A - current measured from multimeter
t - time stamp
Throws IOError exeption if file doesn't exist
returns None
'''
try:
# check if file exists, throws exeption otherwise
times, measurements = getMeasurements(filePath)
average = sum(measurements) / len(measurements)
print('avg = ' + str(average))
# plotting related stuff
pylab.figure(str(datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")), figsize=(22.0, 9.0))
pylab.title(plotLabel)
pylab.xlabel('time, hour')
pylab.ylabel('current, A')
pylab.grid(True)
legend_label = 'avg=' + str("{0:.4f}".format(average)) + 'A'
pylab.plot(times, measurements, '-b', label=legend_label)
mng = pylab.get_current_fig_manager() # get figure manager for
# mng.resize(*mng.window.maxsize()) # setting window size to max
mng.full_screen_toggle()
pylab.legend(loc='best') # should be placed after pylab.plot()
pylab.savefig(plotLabel + ' ' + legend_label + '.png', format='png', dpi=200)
pylab.show()
except IOError:
print "File does not exist! Check file in " + str(filePath)
示例11: onselect
def onselect(xmin, xmax):
global yyy
# this runs after the selection has been made
tb = pl.get_current_fig_manager().toolbar
if tb.mode == '':
# find indices of selection
indmin, indmax = npy.searchsorted(x, (xmin, xmax))
indmax = min(len(x)-1, indmax)
# add selected range to list
ranges.append([indmin,indmax])
thisx = x[indmin:indmax]
thisy = y[indmin:indmax]
# fit polynomial to selected data
n = input('Order of polynomial to fit ? : ')
xx,yy = fit_data(thisx,thisy,n)
polys.append(yy)
# plot polynomial on middle plot over raw data
ax2.plot(xx,yy,'r-')
yyy = y.copy()
# subtract selected ranges from lightcurve
for r in range(len(ranges)):
yyy[ranges[r][0]:ranges[r][1]] -= polys[r]
line3.set_data(x,yyy)
#ax3.plot(x,yyy,'.')
fig.canvas.draw()
示例12: initWidgets
def initWidgets(self):
self.fig = plt.figure(1)
self.manager=get_current_fig_manager()
self.img = subplot(2,1,1)
self.TempGraph=subplot(2,1,2)
x1=sp.linspace(0.0,5.0)
y1=sp.cos(2*sp.pi*x1)*sp.exp(-x1)
plt.plot(x1,y1)
row=0
self.grid()
self.lblPower=tk.Label(self,text="Power")
self.lblPower.grid(row=row,column=0)
self.sclPower=tk.Scale(self,from_=0,to_=100000,orient=tk.HORIZONTAL)
self.sclPower.grid(row=row,column=1,columnspan=3)
#lastrow
row=row+1
self.btnOne=tk.Button(master=self,text="Run")
self.btnOne["command"]=self.Run
self.btnOne.grid(row=row,column=0)
self.btnTwo=tk.Button(master=self,text="Soak")
self.btnTwo["command"]=self.Soak
self.btnTwo.grid(row=row,column=2)
self.QUIT=tk.Button(master=self,text="QUIT")
self.QUIT["command"]=self.quit
self.QUIT.grid(row=row,column=3)
示例13: initWidgets
def initWidgets(self):
self.fig = plt.figure(1)
self.img = subplot(111)
self.manager=get_current_fig_manager()
self.img = subplot(2,1,2)
self.TempGraph=subplot(2,1,1)
row=0
self.grid()
self.lblPower=tk.Label(self,text="Power")
self.lblPower.grid(row=row,column=0)
self.sclPower=tk.Scale(self,from_=0,to_=100,orient=tk.HORIZONTAL)
self.sclPower.grid(row=row,column=1,columnspan=3)
row=row+1
self.lblTime=tk.Label(self,text="Time={0}".format(self.time))
self.lblTime.grid(row=row,column=0)
#lastrow
row=row+1
self.btnOne=tk.Button(master=self,text="Run")
self.btnOne["command"]=self.Run
self.btnOne.grid(row=row,column=0)
self.btnTwo=tk.Button(master=self,text="Soak")
self.btnTwo["command"]=self.Soak
self.btnTwo.grid(row=row,column=2)
self.QUIT=tk.Button(master=self,text="QUIT")
self.QUIT["command"]=self.quit
self.QUIT.grid(row=row,column=3)
示例14: arrange_figures
def arrange_figures(layout=None, screen=2, xgap=10,
ygap=30, offset=0, figlist=None):
"""Automatiskt arrangera alla figurer i ett icke overlappande
monster
*layout*
Anvands inte just nu
*screen* [=2]
anger vilken skarm man i forsta hand vill ha fonstren pa.
*xgap*
Gap i x-led mellan fonster
*ygap*
Gap i y-led mellan fonster
*offset*
Nar skarmen ar fylld borjar man om fran ovre hogra hornet
men med en offset i x och y led.
*figlist*
Lista med figurnummer som skall arrangeras
"""
#Hamta information om total skarmbredd over alla anslutna skarmar
if not is_in_ipython():
return
# pylab.show()
pylab.ioff()
x0 = 0 + offset
y0 = 0 + offset
if screen == 2:
x0 = (pylab.get_current_fig_manager().window.winfo_screenwidth() +
offset)
if figlist is None:
figlist = sorted([x for x in Gcf.figs.items()])
x = x0
y = y0
maxheight = 0
while figlist:
fig = _, f = figlist[0]
figlist = figlist[1:]
if fig_fits_w(f, x):
move_fig(f, x, y)
x = x + f.window.winfo_width() + xgap
maxheight = max(maxheight, f.window.winfo_height())
else:
x = x0
y = y + maxheight + ygap
maxheight = 0
if fig_fits_h(f, y):
move_fig(f, x, y)
x = x + f.window.winfo_width() + xgap
else:
arrange_figures(offset=DELTAOFFSET, xgap=xgap, ygap=ygap,
screen=screen, figlist=[fig] + figlist)
break
pylab.ion()
示例15: gui
def gui(self, log=False, maximize=False):
"""
@param log: show z in log scale
"""
if self.fig is None:
self.fig = pylab.plt.figure()
# add 3 subplots at the same position for debye-sherrer image, contour-plot and massif contour
self.ax = self.fig.add_subplot(111)
self.ct = self.fig.add_subplot(111)
self.msp = self.fig.add_subplot(111)
if log:
self.ax.imshow(numpy.log(1.0 + self.data - self.data.min()), origin="lower", interpolation="nearest")
else:
self.ax.imshow(self.data, origin="lower", interpolation="nearest")
self.ax.autoscale_view(False, False, False)
self.fig.show()
if maximize:
mng = pylab.get_current_fig_manager()
# print mng.window.maxsize()
# *mng.window.maxsize())
win_shape = (1920, 1080)
event = Event(*win_shape)
try:
mng.resize(event)
except TypeError:
mng.resize(*win_shape)
self.fig.canvas.draw()
self.fig.canvas.mpl_connect('button_press_event', self.onclick)