本文整理汇总了Python中matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg.updateGeometry方法的典型用法代码示例。如果您正苦于以下问题:Python FigureCanvasQTAgg.updateGeometry方法的具体用法?Python FigureCanvasQTAgg.updateGeometry怎么用?Python FigureCanvasQTAgg.updateGeometry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg
的用法示例。
在下文中一共展示了FigureCanvasQTAgg.updateGeometry方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg import updateGeometry [as 别名]
def __init__(self, parent=None, width=5, height=4, dpi=100):
fig = Figure(figsize=(width, height), dpi=dpi)
# We want the axes cleared every time plot() is called
self.axes = fig.add_subplot(1, 1, 1)
self.axes.hold(False)
FigureCanvas.__init__(self, fig)
# self.figure
self.setParent(parent)
FigureCanvas.setSizePolicy(self,
QtGui.QSizePolicy.Expanding,
QtGui.QSizePolicy.Expanding)
FigureCanvas.updateGeometry(self)
self._title = ''
self.title_font = {'family': 'serif', 'fontsize': 10}
self._title_size = 0
self.figure.subplots_adjust(top=0.95, bottom=0.15)
window_brush = self.window().palette().window()
fig.set_facecolor(brush_to_color_tuple(window_brush))
fig.set_edgecolor(brush_to_color_tuple(window_brush))
self._active = False
示例2: __init__
# 需要导入模块: from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg import updateGeometry [as 别名]
def __init__(self):
self.fig = Figure()
self.ax = self.fig.add_subplot(111)
FigureCanvas.__init__(self, self.fig)
FigureCanvas.setSizePolicy(self, QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Expanding)
FigureCanvas.updateGeometry(self)
示例3: __init__
# 需要导入模块: from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg import updateGeometry [as 别名]
def __init__(self, parent=None, width=5, height=4, dpi=72):
# fiugrueの生成
self.fig = Figure(figsize=(width, height), dpi=dpi,
facecolor=[0.5, 0.5, 0.5], edgecolor=None,
linewidth=1.0,
frameon=True, tight_layout=True)
# axesハンドルの生成
self.axes = self.fig.add_subplot(111)
# 再描画では上書きしない
self.axes.hold(False)
# 画像の初期表示
self.compute_initial_fiugre()
# コンストラクタ
FigureCanvas.__init__(self, self.fig)
# 親のウィジェットを生成
self.setParent(parent)
# サイズの設定
# FigureCanvas.setSizePolicy(self,
# QtGui.QSizePolicy.Expanding,
# QtGui.QSizePolicy.Expanding)
# サイズの更新
FigureCanvas.updateGeometry(self)
示例4: __init__
# 需要导入模块: from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg import updateGeometry [as 别名]
def __init__(self, parent):
""" Initialization
"""
# from mpl_toolkits.axes_grid1 import host_subplot
# import mpl_toolkits.axisartist as AA
# import matplotlib.pyplot as plt
# Instantiating matplotlib Figure
self.fig = Figure()
self.fig.patch.set_facecolor('white')
if True:
self.axes = self.fig.add_subplot(111) # return: matplotlib.axes.AxesSubplot
self.axes2 = None
else:
self.axes = self.fig.add_host_subplot(111)
# Initialize parent class and set parent
FigureCanvas.__init__(self, self.fig)
self.setParent(parent)
# Set size policy to be able to expanding and resizable with frame
FigureCanvas.setSizePolicy(self, QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Expanding)
FigureCanvas.updateGeometry(self)
# Variables to manage all lines/subplot
self._lineDict = {}
self._lineIndex = 0
# legend and color bar
self._colorBar = None
return
示例5: __init__
# 需要导入模块: from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg import updateGeometry [as 别名]
def __init__(self, parent=None, width = 6, height = 5, dpi = 100, sharex = None, sharey = None):
self.fig = Figure(figsize = (width, height), dpi=dpi, facecolor = '#FFFFFF')
# self.ax = self.fig.add_subplot(211, sharex = sharex, sharey = sharey)
# self.ax2 = self.fig.add_subplot(212, sharex = sharex, sharey = sharey)
self.ax = self.fig.add_axes(mainAx)
self.ax2 = self.fig.add_axes(sideAx)
self.ax2.yaxis.set_major_formatter(nullfmt)
self.axList = [self.ax, self.ax2]
self.fig.subplots_adjust(left=0.1, bottom=0.1, right=0.9, top=0.9)
self.plotTitle = ''
self.xtitle="m/z"#"Drift Time (ms)"
self.ytitle="Intensity"#"Intensity"
self.ax.set_xlabel(self.xtitle, fontsize = 9)
self.ax.set_ylabel(self.ytitle, fontsize = 9)
self.grid_status = True
self.xaxis_style = 'linear'
self.yaxis_style = 'linear'
self.format_labels()
self.ax.hold(True)
FigureCanvas.__init__(self, self.fig)
FigureCanvas.setSizePolicy(self,
QtGui.QSizePolicy.Expanding,
QtGui.QSizePolicy.Expanding)
FigureCanvas.updateGeometry(self)
示例6: __init__
# 需要导入模块: from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg import updateGeometry [as 别名]
def __init__(self, parent, xgrid, zgrid, xcoords, zcoords, width=3, dpi=100):
self.xgrid=xgrid
self.zgrid=zgrid
self.xcoords=xcoords
self.zcoords=zcoords
self.widthpix=width*dpi
self.substrateradius=38.1
self.subfactor=numpy.sqrt(self.substrateradius/38.1) #the axes scales are not automated,
self.fig = Figure(figsize=(width, width), dpi=dpi)
FigureCanvas.__init__(self, self.fig)
self.setParent(parent)
self.axes = self.fig.add_subplot(111, aspect=1, frame_on=False)
temp=self.axes.get_position().get_points()
self.radiusmm=self.substrateradius+4
self.pixpermm=temp[1, 0]*self.widthpix/(2.0*self.radiusmm)
self.xpixshift=(temp[0, 0]+temp[1, 0]/2.0)*self.widthpix
self.ypixshift=(temp[0, 1]+temp[1, 0]/2.0)*self.widthpix
#self.axes.set_axis_bgcolor('w') #this doesn't seem to work
self.axesformat()
# We want the axes cleared every time plot() is called
self.axes.hold(False)
self.mpl_connect('button_press_event', self.myclick)
self.inxvals=[]
self.inzvals=[]
self.exxvals=[]
self.exzvals=[]
self.includelist=[]
self.excludelist=[]
FigureCanvas.setSizePolicy(self, QSizePolicy.Fixed, QSizePolicy.Fixed)
FigureCanvas.updateGeometry(self)
示例7: __init__
# 需要导入模块: from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg import updateGeometry [as 别名]
def __init__(
self,
parent=None,
title="",
xlabel="",
ylabel="",
xlim=None,
ylim=None,
xscale="linear",
yscale="linear",
width=4,
height=3,
dpi=100,
hold=False,
):
self.figure = Figure(figsize=(width, height), dpi=dpi)
self.axes = self.figure.add_subplot(111)
self.axes.set_title(title)
self.axes.set_xlabel(xlabel)
self.axes.set_ylabel(ylabel)
if xscale is not None:
self.axes.set_xscale(xscale)
if yscale is not None:
self.axes.set_yscale(yscale)
if xlim is not None:
self.axes.set_xlim(*xlim)
if ylim is not None:
self.axes.set_ylim(*ylim)
self.axes.hold(hold)
Canvas.__init__(self, self.figure)
self.setParent(parent)
Canvas.setSizePolicy(self, QSizePolicy.Expanding, QSizePolicy.Expanding)
Canvas.updateGeometry(self)
示例8: __init__
# 需要导入模块: from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg import updateGeometry [as 别名]
def __init__(self, parent=None, title='', xlabel='', ylabel='',
xlim=None, ylim=None, xscale='linear', yscale='linear',
width=4, height=3, dpi=100, hold=True, X = None, Y = None, Z = None):
self.figure = Figure(figsize=(width, height), dpi=dpi)
self.axes = self.figure.add_subplot(111)
self.axes.set_title(title)
self.axes.set_xlabel(xlabel)
self.axes.set_ylabel(ylabel)
if xscale is not None:
self.axes.set_xscale(xscale)
if yscale is not None:
self.axes.set_yscale(yscale)
if xlim is not None:
self.axes.set_xlim(*xlim)
if ylim is not None:
self.axes.set_ylim(*ylim)
self.axes.hold(hold)
if X is not None:
self.X = X
if Y is not None:
self.Y = Y
if Z is not None:
self.Z = Z
FigureCanvas.__init__(self, self.figure)
if parent is not None:
self.setParent(parent)
#Canvas.setSizePolicy(self, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
FigureCanvas.updateGeometry(self)
示例9: __init__
# 需要导入模块: from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg import updateGeometry [as 别名]
def __init__(self, parent=None, width=9, height=6, dpi=None):
self.fig = Figure(figsize=(width, height), facecolor=(.94,.94,.94), dpi=dpi)
FigureCanvas.__init__(self, self.fig)
self.setParent(parent)
FigureCanvas.setSizePolicy(self,
QSizePolicy.Expanding,
QSizePolicy.Expanding)
FigureCanvas.updateGeometry(self)
self.axes = self.fig.add_axes([0.06, 0.10, 0.9, 0.85], facecolor=(.94,.94,.94))
self.compute_initial_figure()
# horizontal x range span
axxspan = self.fig.add_axes([0.06, 0.05, 0.9, 0.02])
axxspan.axis([-0.2, 1.2, -0.2, 1.2])
axxspan.tick_params('y', labelright = False ,labelleft = False ,length=0)
self.xspan = SpanSelector(axxspan, self.onselectX, 'horizontal',useblit=True, span_stays=True, rectprops=dict(alpha=0.5, facecolor='blue'))
# vertical y range span
axyspan = self.fig.add_axes([0.02, 0.10, 0.01, 0.85])
axyspan.axis([-0.2, 1.2, -0.2, 1.2])
axyspan.tick_params('x', labelbottom = False ,labeltop = False ,length=0)
self.yspan = SpanSelector(axyspan, self.onselectY, 'vertical',useblit=True, span_stays=True, rectprops=dict(alpha=0.5, facecolor='blue'))
# reset x y spans
axReset = self.fig.add_axes([0.01, 0.05, 0.03, 0.03],frameon=False, )
self.bnReset = Button(axReset, 'Reset')
self.bnReset.on_clicked( self.xyReset )
# contextMenu
acExportPlot = QAction(self.tr("Export plot"), self)
FigureCanvas.connect(acExportPlot,SIGNAL('triggered()'), self, SLOT('exportPlot()') )
FigureCanvas.addAction(self, acExportPlot )
FigureCanvas.setContextMenuPolicy(self, Qt.ActionsContextMenu )
示例10: __init__
# 需要导入模块: from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg import updateGeometry [as 别名]
def __init__(self, spectrometers,parent=None, width=4, height=4.5, dpi=100):
self.counter = 0
self.spectrometers = spectrometers
self.fig = Figure(figsize=(width, height), dpi=dpi)
self.plots = []
self.xmins, self.xmaxs, self.ymins, self.ymaxs = [], [], [], []
self.update_paused = True
self.thread_paused_override = self.spectrometers.thread.paused
self.logscale = [semilogy_scale, semilogy_scale, semilogy_scale]
self.update_time = 50#ms
for i in range(self.spectrometers.num_spectrometers):
print i
self.plots.append(self.fig.add_subplot(self.spectrometers.num_spectrometers,1,i+1))
self.xmins.append(560)
self.xmaxs.append(600)
self.ymins.append(0.1)
self.ymaxs.append(500)
self.fig.subplots_adjust(bottom=0.15,left=0.20,top=0.9,right=0.95)
for axes in self.plots:
axes.hold(False)
FigureCanvas.__init__(self, self.fig)
self.setParent(parent)
FigureCanvas.setSizePolicy(self,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Expanding)
FigureCanvas.updateGeometry(self)
self.compute_initial_figure()
self.timer = QtCore.QTimer(self)
QtCore.QObject.connect(self.timer, QtCore.SIGNAL("timeout()"), self.update_figure)
self.timer.start(self.update_time) #in ms
示例11: __init__
# 需要导入模块: from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg import updateGeometry [as 别名]
def __init__(self, parent=None, width = 10, height = 12, dpi = 100, sharex = None, sharey = None):
self.fig = Figure(figsize = (width, height), dpi=dpi, facecolor = '#FFFFFF')
self.ax = Axes3D(self.fig)
# n = 100
# for c, zl, zh in [('r', -50, -25), ('b', -30, -5)]:
# xs = randrange(n, 23, 32)
# ys = randrange(n, 0, 100)
# zs = randrange(n, zl, zh)
self.ax.scatter3D(S.rand(200), S.rand(200), S.rand(200))#, c = c, alpha = 0.8)
self.ax.set_xlabel('X Label')
self.ax.set_ylabel('Y Label')
self.ax.set_zlabel('Z Label')
# self.ax = self.fig.add_subplot(111, sharex = sharex, sharey = sharey)
# self.fig.subplots_adjust(left=0.1, bottom=0.1, right=0.9, top=0.9)
self.xtitle="x-Axis"
self.ytitle="y-Axis"
self.PlotTitle = "Plot"
self.grid_status = True
self.xaxis_style = 'linear'
self.yaxis_style = 'linear'
self.format_labels()
self.ax.hold(True)
FigureCanvas.__init__(self, self.fig)
#self.fc = FigureCanvas(self.fig)
FigureCanvas.setSizePolicy(self,
QtGui.QSizePolicy.Expanding,
QtGui.QSizePolicy.Expanding)
FigureCanvas.updateGeometry(self)
示例12: __init__
# 需要导入模块: from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg import updateGeometry [as 别名]
def __init__(self, parent=None, width=5, height=4, dpi=100):
self.fig1 = Figure(figsize=(width, height), dpi=dpi)
self.fig2 = Figure(figsize=(width, height), dpi=dpi)
fig3 = Figure(figsize=(width, height), dpi=dpi)
self.axes1 = self.fig1.add_subplot(223)
print self.axes1.__class__.__name__
self.axes2 = self.fig2.add_subplot(221)
# We want the axes cleared every time plot() is called
#self.axes.hold(False)
#self.axes2.hold(False)
self.compute_initial_figure()
#
FigureCanvas.__init__(self, self.fig1)
self.setParent(parent)
FigureCanvas.setSizePolicy(self,
QtGui.QSizePolicy.Expanding,
QtGui.QSizePolicy.Expanding)
FigureCanvas.updateGeometry(self)
t = arange(0.0, 1.0, 0.01)
s = sin(2*pi*t)
axes3 = fig3.add_subplot(1, 2, 2)
axes3.plot(t,s)
axes3.set_figure(self.fig1)
self.fig1.add_axes(axes3)
示例13: __init__
# 需要导入模块: from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg import updateGeometry [as 别名]
def __init__(self):
self.fig = Figure(facecolor="white", frameon=False)
self.ax = self.fig.add_subplot(111)
FigureCanvas.__init__(self, self.fig)
FigureCanvas.setSizePolicy(self, QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Expanding)
FigureCanvas.updateGeometry(self)
示例14: __init__
# 需要导入模块: from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg import updateGeometry [as 别名]
def __init__(self, parent=None):
self.fig = Figure()
self.axes = self.fig.add_subplot(111)
FigureCanvas.__init__(self, self.fig)
#----Creation des tableaux de donnees-----
self.tableau_parametre = []
self.tableau_rdt = []
self.tableau_xHI = []
self.tableau_aI2 = []
self.tableau_aH2 = []
self.l_tableau_rdt, = self.axes.plot(self.tableau_parametre, self.tableau_rdt, color="0.25", linestyle="-", linewidth="2", label="Rendement")
self.l_tableau_xHI, = self.axes.plot(self.tableau_parametre, self.tableau_xHI,color="red", linestyle="-", linewidth="2", label="x(HI)")
self.l_tableau_aI2, = self.axes.plot(self.tableau_parametre, self.tableau_xHI, color="blue", linestyle=":", linewidth="4", label="alpha(I2)")
self.l_tableau_aH2, = self.axes.plot(self.tableau_parametre, self.tableau_xHI, color="green", linestyle="--", linewidth="3", label="alpha(H2)")
self.axes.legend()
self.axes.set_ylim(0.0, 1.0)
self.axes.set_xlabel("Rapport initial n(H2)/n(I2)")
self.setParent(parent)
FigureCanvas.setSizePolicy(self, QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Expanding)
FigureCanvas.updateGeometry(self)
示例15: MplAxes
# 需要导入模块: from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg import updateGeometry [as 别名]
class MplAxes(object):
def __init__(self, parent):
self._parent = parent
self._parent.resizeEvent = self.resize_graph
self.create_axes()
self.redraw_figure()
def create_axes(self):
self.figure = Figure(None, dpi=100)
self.canvas = FigureCanvas(self.figure)
self.canvas.setParent(self._parent)
axes_layout = QtGui.QVBoxLayout(self._parent)
axes_layout.setContentsMargins(0, 0, 0, 0)
axes_layout.setSpacing(0)
axes_layout.setMargin(0)
axes_layout.addWidget(self.canvas)
self.canvas.setSizePolicy(QtGui.QSizePolicy.Expanding,
QtGui.QSizePolicy.Expanding)
self.canvas.updateGeometry()
self.axes = self.figure.add_subplot(111)
def resize_graph(self, event):
new_size = event.size()
self.figure.set_size_inches([new_size.width() / 100.0, new_size.height() / 100.0])
self.redraw_figure()
def redraw_figure(self):
self.figure.tight_layout(None, 0.8, None, None)
self.canvas.draw()