本文整理汇总了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函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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)
开发者ID:fraserw,项目名称:Cassini,代码行数:25,代码来源:findCratersManual.py
示例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()
开发者ID:soukingang,项目名称:Treemap,代码行数:7,代码来源:treemap.py
示例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()
开发者ID:takutos,项目名称:nomads,代码行数:8,代码来源:pymas.py
示例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()
开发者ID:romainjayles,项目名称:prey,代码行数:10,代码来源:orientation_visualisation.py
示例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)
开发者ID:freifeld,项目名称:of,代码行数:11,代码来源:__init__.py
示例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)
开发者ID:jkrueger1,项目名称:McCode,代码行数:51,代码来源:mcplot.py
示例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()
开发者ID:romainjayles,项目名称:prey,代码行数:14,代码来源:accel_gyro_visualisation.py
示例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()
开发者ID:JoErNanO,项目名称:brian,代码行数:15,代码来源:plotting.py
示例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()
开发者ID:badbytes,项目名称:pymeg,代码行数:35,代码来源:megcontour_gtk.py
示例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)
开发者ID:mikedanylov,项目名称:meaplot-Fluke289,代码行数:32,代码来源:meaplotter.py
示例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()
开发者ID:ezietsman,项目名称:msc-thesis,代码行数:35,代码来源:span_selector.py
示例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)
开发者ID:JohnBayldon,项目名称:Diffusion,代码行数:35,代码来源:Basic3DTk.py
示例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)
开发者ID:JohnBayldon,项目名称:Diffusion,代码行数:35,代码来源:Press.py
示例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()
开发者ID:arsenovic,项目名称:hftools,代码行数:60,代码来源:helper.py
示例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)
开发者ID:blackw1ng,项目名称:pyFAI,代码行数:28,代码来源:peakPicker.py
示例16: quiver_image
def quiver_image(X, Y, U, V):
pylab.figure(1)
pylab.quiver(X, Y, U, V)
canvas = pylab.get_current_fig_manager().canvas
canvas.draw()
pil_image = Image.fromstring('RGB', canvas.get_width_height(), canvas.tostring_rgb())
return pil_image
开发者ID:AndreaCensi,项目名称:surf12adam,代码行数:7,代码来源:contourf_quiver_3d.py
示例17: __init__
def __init__(self, x, y):
f = matplotlib.figure.Figure(figsize=(5, 4), dpi=100)
# f = matplotlib.figure.Figure(dpi=100)
ax = f.add_subplot(111)
canvas = ax.figure.canvas
line, = p.plot(x, y, animated=True, lw=2)
canvas = FigureCanvasTkAgg(f, master=root)
canvas.show()
canvas.get_tk_widget().grid()
toolbar = NavigationToolbar2TkAgg(canvas, root)
toolbar.update()
canvas._tkcanvas.pack(side=Tk.TOP, fill=Tk.BOTH, expand=1)
p.subplots_adjust(left=-0.1, bottom=0.0)
manager = p.get_current_fig_manager()
manager.window.after(100, self.run)
self.canvas = canvas
self.ax = ax
self.line = line
self.x = x
self.y = y
开发者ID:xkenneth,项目名称:pydrill,代码行数:27,代码来源:AnimatedGraph.py
示例18: 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.pause(0.001) # prevents the NotImplementedError
pylab.get_current_fig_manager().canvas.flush_events()
开发者ID:brian-team,项目名称:brian,代码行数:16,代码来源:plotting.py
示例19: plot_data
def plot_data(yRange=None):
'''
Plots and saves the cell measurement data. Returns nothing.
'''
fig = plt.figure(figsize=(18,12))
ax = plt.subplot(111)
plt.errorbar(range(len(avgCells.index)), avgCells[column], yerr=stdCells[column], fmt='o')
ax = plt.gca()
ax.set(xticks=range(len(avgCells.index)), xticklabels=avgCells.index)
xlims = ax.get_xlim()
ax.set_xlim([lim-1 for lim in xlims])
# adjust yRange if it was specified
if yRange!=None:
ax.set_ylim(yRange)
fileName = column + ' exlcuding outliers'
else:
fileName = column
plt.subplots_adjust(bottom=0.2, right=0.98, left=0.05)
plt.title(column)
plt.ylabel('mm')
locs, labels = plt.xticks()
plt.setp(labels, rotation=90)
mng = plt.get_current_fig_manager()
mng.window.state('zoomed')
#plt.show()
path1 = 'Y:/Test data/ACT02/vision inspection/plot_100_cells/'
path2 = 'Y:/Nate/git/nuvosun-python-lib/vision system/plot_100_cells/'
fig.savefig(path1 + fileName, bbox_inches = 'tight')
fig.savefig(path2 + fileName, bbox_inches = 'tight')
plt.close()
开发者ID:nateGeorge,项目名称:nuvosun-python-lib,代码行数:30,代码来源:check+precision.py
示例20: run
def run():
colors = [
'b', 'g', 'r', 'c', 'm', 'y', 'k',
'b--', 'g--', 'r--', 'c--', 'm--', 'y--', 'k--',
'bo', 'go', 'ro', 'co', 'mo', 'yo', 'ko',
'b+', 'g+', 'r+', 'c+', 'm+', 'y+', 'k+',
'b*', 'g*', 'r*', 'c*', 'm*', 'y*', 'k*',
'b|', 'g|', 'r|', 'c|', 'm|', 'y|', 'k|',
]
plots = defaultdict(list)
heap_size = []
order = ['Heap change']
manager = pylab.get_current_fig_manager()
manager.resize(1400, 1350)
pylab.ion()
for entry in read_data():
heap_size.append(entry["after"]["size_bytes"])
pylab.subplot(2, 1, 1)
pylab.plot(heap_size, 'r', label='Heap size')
pylab.legend(["Heap size"], loc=2)
pylab.subplot(2, 1, 2)
plots["Heap change"].append(entry["change"]["size_bytes"])
for thing in entry["change"]["details"]:
if thing["what"] not in order:
order.append(thing["what"])
plots[thing["what"]].append(thing["size_bytes"])
for what, color in zip(order, colors):
pylab.plot(plots[what], color, label=what)
pylab.legend(order, loc=3)
pylab.draw()
开发者ID:creativeprogramming,项目名称:unhangout,代码行数:34,代码来源:plot_memory.py
注:本文中的pylab.get_current_fig_manager函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论