当前位置: 首页>>代码示例>>Python>>正文


Python FigureCanvasQTAgg.__init__方法代码示例

本文整理汇总了Python中matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python FigureCanvasQTAgg.__init__方法的具体用法?Python FigureCanvasQTAgg.__init__怎么用?Python FigureCanvasQTAgg.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg的用法示例。


在下文中一共展示了FigureCanvasQTAgg.__init__方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg import __init__ [as 别名]
    def __init__(self, parent):

        self.parent = parent
        self.fig = Figure()
        self.ax = self.fig.add_subplot(111)
        FigureCanvas.__init__(self, self.fig)
        #self.cidPress = self.mpl_connect('button_press_event', self.onClick)
        #self.cidRelease = self.mpl_connect('button_release_event', self.onRelease)


        #self.X = np.random.rand(5,5)
        #rows,cols,self.slices = self.X.shape
        #self.Y = np.random.rand(5,5)
        #rows,cols,self.slices = self.X.shape
        
        newdata = np.ones(2*2)
        newarray = np.reshape(newdata, (2, 2))
        self.data = newarray

        
        #self.im = self.ax.matshow(self.X[:,:])
        #self.im = self.ax.matshow(self.data)
        self.update()
        
        self.fig.canvas.draw()

        self.cnt = 0
        
        self.setupSelector()
开发者ID:HaeffnerLab,项目名称:sqip,代码行数:31,代码来源:AndorClient.py

示例2: __init__

# 需要导入模块: from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg import __init__ [as 别名]
    def __init__(self, parent=None, width=5, height=5, dpi=72):
        self.fontsize = 10
        # fiugrueの生成
        # self.fig = plt.figure(figsize=(width, height), dpi=72, facecolor=(1, 1, 1), edgecolor=(0, 0, 0),
        #                       tight_layout=False)
        self.fig = plt.figure(figsize=(width, height), dpi=72,tight_layout=False)

        # axesハンドルの生成
        self.axes = self.fig.add_subplot(111)
        # 再描画では上書きしない
        self.axes.hold(False)
        # コンストラクタ
        FigureCanvas.__init__(self, self.fig)
        # 親のウィジェットを生成
        self.setParent(parent)
        # サイズの更新
        FigureCanvas.updateGeometry(self)

        # シークバーの格納
        self.seakbar_handle = None
        self.seakbar_xdata = [1, 1]
        self.seakbar_ydata = [-1, 1]

        # メインラインハンドルの格納
        self.mainline_handle = None

        # 画像の初期表示
        self.compute_initial_fiugre()
开发者ID:peace098beat,项目名称:SignalProcessingApp,代码行数:30,代码来源:MplCanvas.py

示例3: __init__

# 需要导入模块: from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg import __init__ [as 别名]
    def __init__(self, parent=None, width=5, height=4, dpi=100):
        self.fig = Figure(figsize=(width, height), dpi=dpi)
        FigureCanvasQTAgg.__init__(self, self.fig)

        self.setParent(parent)
        FigureCanvas.setSizePolicy(self, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
        FigureCanvas.updateGeometry(self)
开发者ID:cta-observatory,项目名称:dragonboard_testbench,代码行数:9,代码来源:plotting.py

示例4: __init__

# 需要导入模块: from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg import __init__ [as 别名]
    def __init__(self, figure = 1):

        self.QWP = np.matrix([[ np.exp(1.j*pi/4) , 0],\
                                     [ 0 , np.exp(-1.j*pi/4)]])

        fig_1, fig_2 = plot_ellipse( Rotate(self.QWP,-pi/4)*\
                                                   np.matrix([[np.cos(-3*pi/8)],\
                                                                     [np.sin(-3*pi/8)]],\
                                                                      dtype = 'complex'), \
                                                  show = False, retrieve = True)

        if figure ==1:
            self.fig = fig_1
        elif figure == 2:
            self.fig = fig_2
        else:
            raise ValueError("Oops!  That was no valid number.  Try again...")

        self.fig.hold(False)
    
        FigureCanvas.__init__(self, self.fig)
        FigureCanvas.setSizePolicy(self, 
                QtGui.QSizePolicy.Expanding, 
                QtGui.QSizePolicy.Expanding)
        FigureCanvas.updateGeometry(self)
开发者ID:bebopsan,项目名称:Ellipsometry_for_dummies,代码行数:27,代码来源:mplwidget_flymake.py

示例5: __init__

# 需要导入模块: from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg import __init__ [as 别名]
    def __init__(self, parent=None, width=5, height=4, dpi=100):
        self.fig = Figure(figsize=(width, height), dpi=dpi)
        self.axes = self.fig.add_subplot(111)
        i = self.axes.imshow(np.outer(np.linspace(0, 1, 10), np.linspace(0, 2, 10)), zorder=1)
        self.cbar = self.fig.colorbar(i)
        # We want the axes cleared every time plot() is called
        #        self.axes.hold(False)

        #
        FigureCanvas.__init__(self, self.fig)
        self.setParent(parent)

        FigureCanvas.setSizePolicy(self, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
        FigureCanvas.updateGeometry(self)

        self.crosshairs_x = 0
        self.crosshairs_y = 0

        self.bg_rect = Rectangle((0, 0), 0, 0, facecolor="blue", edgecolor="blue", alpha=0.3, zorder=8)
        self.axes.add_patch(self.bg_rect)

        self.signal_rect = Rectangle((0, 0), 0, 0, facecolor="red", edgecolor="red", alpha=0.3, zorder=9)
        self.axes.add_patch(self.signal_rect)

        self.anno = spot_picker.Annotate(self.axes)
        self.draw()
开发者ID:kiwimatto,项目名称:2dpolim-analysis,代码行数:28,代码来源:am_gui.py

示例6: __init__

# 需要导入模块: from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg import __init__ [as 别名]
    def __init__(self, Maskable=False):
        QtCore.QObject.__init__(self)
        # Member elements for storing image formatting parameters
        self.circles = []
        self.cadj = lambda x: x
        self.filterstack = []
        self.CMap = 'gray'
        self.data = []
        self.im = None
        self.cbar = None
        self.aspectRatio = None
        self.minMax = None
        self.mask = None
        self.maskable = Maskable
        # Setup the canvas and axes
        self.fig = Figure()
        self.ax = self.fig.add_subplot(111, aspect='equal')
        self.ax.set_axis_off()

        # Need to understand what this actually does....
        FigureCanvasQTAgg.__init__(self, self.fig)
        FigureCanvasQTAgg.setSizePolicy(self, QtGui.QSizePolicy.Expanding,
                                        QtGui.QSizePolicy.Expanding)
        FigureCanvasQTAgg.updateGeometry(self)

        self.fig.canvas.mpl_connect('button_press_event', self._plotClick)
开发者ID:nealaholl,项目名称:MrMagic,代码行数:28,代码来源:mplwidget.py

示例7: __init__

# 需要导入模块: from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg import __init__ [as 别名]
 def __init__(self):
     """Constructor"""
     # Create the figure in the canvas
     self.fig = Figure()
     self.ax = self.fig.add_subplot(111)
     FigureCanvas.__init__(self, self.fig)
     # generates first "empty" plot
     t = [0.0]
     e = [0.0]
     self.line, = self.ax.plot(t,
                               e,
                               color="black",
                               linestyle="-",
                               linewidth=1.0)
     # Set some options
     self.T = {{L}} / {{U}}
     self.Ek = {{E_KIN}}
     self.ax.grid()
     self.ax.set_xlim(0, 10.0)
     self.ax.set_ylim(0.0, 1.1)
     self.ax.set_autoscale_on(False)
     self.ax.set_xlabel(r"$t U / L$", fontsize=21)
     self.ax.set_ylabel(r"$\mathcal{E}_{k}(t) / \mathcal{E}_{k}(0)$", fontsize=21)
     # force the figure redraw
     self.fig.canvas.draw()
     # call the update method (to speed-up visualization)
     self.timerEvent(None)
     # start timer, trigger event every 1000 millisecs (=1sec)
     self.timer = self.startTimer(1000)
开发者ID:sanguinariojoe,项目名称:aquagpusph,代码行数:31,代码来源:plot_e.py

示例8: __init__

# 需要导入模块: from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg import __init__ [as 别名]
    def __init__(self, parent):

        self.fig = matplotlib.figure.Figure()
        self.list_of_signals = []
        self.list_of_subplots = []
        self.sub_plot_number = 0
        self.grid_spec = gridspec.GridSpec(5, 1)
        
        #self.fig.gca().xaxis.set_major_formatter(
        #    mdates.DateFormatter('%m/%d/%Y'))
        #self.fig.gca().xaxis.set_major_locator(
        #    mdates.DayLocator())
        FigureCanvasQTAgg.__init__(self, self.fig)
        self.setParent(parent)

        #self.axes = self.fig.add_subplot(self.grid_spec[0])
        #self.axes = self.fig.add_subplot(111)
        # self.axes.set_ylabel("Y-Axis")
        # self.axes.set_xlabel("X-Axis")

        # we define the widget as expandable
        FigureCanvasQTAgg.setSizePolicy(self,
                                        QtGui.QSizePolicy.Expanding,
                                        QtGui.QSizePolicy.Expanding)
        # notify the system of updated policy
        FigureCanvasQTAgg.updateGeometry(self)
开发者ID:ptracton,项目名称:wb_dsp,代码行数:28,代码来源:QtMpl.py

示例9: _setup_plot

# 需要导入模块: from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg import __init__ [as 别名]
    def _setup_plot(self):
        # Image setup
        self.fig = Figure()

        FigureCanvas.__init__(self, self.fig)

        # Create plot, set x and y axes
        ax = self.fig.add_subplot(111)
        ax.set_ylim(0, 100)

        # Build up timestamps
        base = datetime.datetime.now()
        date_ranges = [base - datetime.timedelta(seconds=x) for x in range(0,self.window_size)]

        for pin in range(5):
            sensor_values = [0] * self.window_size

            s_plot, = ax.plot(date_ranges,sensor_values, label="Analog {}".format(pin))

            # Add the ax and plot to our monitor
            self.sensor_readings[pin] = sensor_values
            plot_dict = {'plot': s_plot, 'ax': ax}
            self.sensor_plots[pin] = plot_dict

        # Show legend
        ax.legend()

        # Fix date formatting
        self.fig.autofmt_xdate();

        # Draw the initial canvas
        self.fig.canvas.draw()
开发者ID:wtgee,项目名称:Arduino-Playground,代码行数:34,代码来源:serial_plot.py

示例10: __init__

# 需要导入模块: from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg import __init__ [as 别名]
 def __init__(self, dataGenerator, dtTimer=1000, ylim=None, xlim=None, startsWithZeroZero=False, title=''):
     self.fig = Figure()
     self.ax = self.fig.add_subplot(111)
     FigureCanvas.__init__(self, self.fig)
     self.title = title
     self.dataGen = dataGenerator
     x, t = self.dataGen.next()
     self.setTitle(t)
     self.counter = 1
     self.width = 0.8
     self.locs = np.arange(len(x))
     self.bars = self.ax.bar(self.locs, x, self.width, color='#6a7ea6')
     if not ylim: ylim = []
     if not xlim: xlim = []
     if (startsWithZeroZero):
         if (ylim):
             ylim[0] = 0
         else:
             ylim = [0, max(x * 1.1)]
         if (xlim):
             xlim[0] = -0.5
         else:
             xlim = [-0.5, len(x)]
     if (ylim): self.ax.set_ylim(ylim[0], ylim[1])
     if (xlim): self.ax.set_xlim(xlim[0], xlim[1])
     self.fig.canvas.draw()
     self.show()
     self.timer = self.startTimer(dtTimer)
开发者ID:ohadfel,项目名称:Baus,代码行数:30,代码来源:plots.py

示例11: __init__

# 需要导入模块: from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg import __init__ [as 别名]
    def __init__(self, ui, parent=None, width=5,
                 height=4, dpi=100):
        """Creates a new MplCanvas

        Parameters
        ----------
        ui: the application's ui

        Returns
        -------
        a new MplCanvas
        """
        self.function_updater = FunctionUpdater(ui)
        self.quad_updater = QuadUpdater(ui, self.function_updater)

        # Create a matplotlib figure
        self.fig = Figure(figsize=(width, height), dpi=dpi)

        # Initialize the parent class
        FigureCanvas.__init__(self, self.fig)
        self.setParent(parent)
        FigureCanvas.setSizePolicy(self,
                                   QtGui.QSizePolicy.Expanding,
                                   QtGui.QSizePolicy.Expanding)
        FigureCanvas.updateGeometry(self)

        # Register the update_figure function with the update button
        update_button = ui.update_button
        update_button.clicked.connect(self.update_figure)

        # Call update_figure for the first time to initialize
        # the graph
        self.update_figure()
开发者ID:Cheeser12,项目名称:quadrature_tool,代码行数:35,代码来源:quad_program.py

示例12: __init__

# 需要导入模块: from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg import __init__ [as 别名]
 def __init__(self,parent=None,width=5,height=4,dpi=100):
     figure = Figure(figsize=(width,height),dpi=dpi)
     FigureCanvas.__init__(self,figure)
     self.setParent(parent)
     self.axes = figure.add_subplot(111)
     self.axes.hold(False)
     self.axeX = [0]
开发者ID:CodingDuff,项目名称:MR52_R-n-Game,代码行数:9,代码来源:mrFigureCanvas.py

示例13: __init__

# 需要导入模块: from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg import __init__ [as 别名]
    def __init__(self, map_, width, height, parent=None, dpi=100, **matplot_args):  # pylint: disable=W0613
        # self._widthHint = width
        # self._heightHint = height

        self._origMap = map_
        self._map = map_.resample((width, height))

        # Old way (segfaults in some environements)
        # self.figure = self._map.plot_simple(**matplot_args)
        # FigureCanvas.__init__(self, self.figure)

        self.figure = Figure()
        self._map.plot(figure=self.figure, basic_plot=True, **matplot_args)
        self.axes = self.figure.gca()
        FigureCanvas.__init__(self, self.figure)

        # How can we get the canvas to preserve its aspect ratio when expanding?
        # sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred)
        # sizePolicy.setHeightForWidth(True)
        # self.setSizePolicy(sizePolicy)

        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
        self.setSizePolicy(sizePolicy)
        self.setMinimumSize(QtCore.QSize(width, height))
        self.setMaximumSize(QtCore.QSize(width, height))
开发者ID:katrienbonte,项目名称:sunpy,代码行数:27,代码来源:rgb_composite.py

示例14: __init__

# 需要导入模块: from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg import __init__ [as 别名]
    def __init__(self, parent, comp, elstrlist, width=3, dpi=100):
        self.comp=comp
        self.cart=cart_comp(comp)

        compdist=compdistarr_comp(self.comp)
        mincompdist=numpy.min(compdist[compdist>0.])
        self.clickradius=max(.02, mincompdist/2.0)
        self.elstrlist=elstrlist

        self.widthpix=width*dpi
        self.fig = Figure(figsize=(width/.866, width), dpi=dpi)
        FigureCanvas.__init__(self, self.fig)
        self.setParent(parent)
        self.axes = self.fig.add_subplot(111, aspect=.866, frame_on=False)

        self.pixpercomp=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)
开发者ID:johnmgregoire,项目名称:vanDover_CHESS,代码行数:34,代码来源:xrdPLOT.py

示例15: __init__

# 需要导入模块: from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg import __init__ [as 别名]
    def __init__(self, parent=None,
                 size = (7,3.5),
                 dpi = 100,
                 logx = False,
                 logy = False,
                 legends = True,
                 bw = False):

        self.fig = Figure(figsize=size, dpi=dpi) #in inches
        FigureCanvas.__init__(self, self.fig)
        FigureCanvas.setSizePolicy(self,
                                   qt.QSizePolicy.Expanding,
                                   qt.QSizePolicy.Expanding)
        self.curveTable = None
        self.dpi=dpi
        ddict = {'logx':logx,
                 'logy': logy,
                 'legends':legends,
                 'bw':bw}
        self.ax=None
        self.curveList = []
        self.curveDict = {}
        self.setParameters(ddict)
        #self.setBlackAndWhiteEnabled(bw)
        #self.setLogXEnabled(logx)
        #self.setLogYEnabled(logy)
        #self.setLegendsEnabled(legends)

        self.xmin = None
        self.xmax = None
        self.ymin = None
        self.ymax = None
        self.limitsSet = False
开发者ID:marcus-oscarsson,项目名称:pymca,代码行数:35,代码来源:QPyMcaMatplotlibSave1D.py


注:本文中的matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg.__init__方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。