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


Python backend_agg.FigureCanvasAgg类代码示例

本文整理汇总了Python中backend_agg.FigureCanvasAgg的典型用法代码示例。如果您正苦于以下问题:Python FigureCanvasAgg类的具体用法?Python FigureCanvasAgg怎么用?Python FigureCanvasAgg使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: mouseReleaseEvent

 def mouseReleaseEvent(self, event):
     x = event.x()
     # flipy so y=0 is bottom of canvas
     y = self.figure.bbox.height - event.y()
     button = self.buttond[event.button()]
     FigureCanvasAgg.button_release_event(self, x, y, button)
     self.draw()
开发者ID:BackupTheBerlios,项目名称:simuvis4-svn,代码行数:7,代码来源:backend_sv4agg.py

示例2: __init__

 def __init__( self, figure ):
     if DEBUG: print 'FigureCanvasQtAgg: ', figure
     FigureCanvasQT.__init__( self, figure )
     FigureCanvasAgg.__init__( self, figure )
     self.drawRect = False
     self.rect = []
     self.replot = True
     self.setAttribute(QtCore.Qt.WA_OpaquePaintEvent)
开发者ID:08s011003,项目名称:nupic,代码行数:8,代码来源:backend_qt4agg.py

示例3: copy_from_bbox

 def copy_from_bbox(self, *args):
     """
     If a draw() has been called but the update() has not
     occurred, draw into the agg canvas before copying.
     """
     if self.replot:
         FigureCanvasAgg.draw(self)
         self.replot = False
     return FigureCanvasAgg.copy_from_bbox(self, *args)
开发者ID:AlexSzatmary,项目名称:matplotlib,代码行数:9,代码来源:backend_qt4agg.py

示例4: print_figure

 def print_figure(self, filename, *args, **kwargs):
     # Use pure Agg renderer to draw
     FigureCanvasAgg.print_figure(self, filename, *args, **kwargs)
     # Restore the current view; this is needed because the
     # artist contains methods rely on particular attributes
     # of the rendered figure for determining things like
     # bounding boxes.
     if self._isDrawn:
         self.draw()
开发者ID:EnochManohar,项目名称:matplotlib,代码行数:9,代码来源:backend_wxagg.py

示例5: draw

 def draw( self ):
     """
     Draw the figure with Agg, and queue a request
     for a Qt draw.
     """
     # The Agg draw is done here; delaying it until the paintEvent
     # causes problems with code that uses the result of the
     # draw() to update plot elements.
     FigureCanvasAgg.draw(self)
     self.update()
开发者ID:KiranPanesar,项目名称:wolfpy,代码行数:10,代码来源:backend_qt4agg.py

示例6: draw

    def draw(self, repaint=True):
        """
        Render the figure using agg.
        """
        DEBUG_MSG("draw()", 1, self)
        FigureCanvasAgg.draw(self)

        self.bitmap = _convert_agg_to_wx_bitmap(self.get_renderer(), None)
        if repaint:
            self.gui_repaint()
开发者ID:gkliska,项目名称:razvoj,代码行数:10,代码来源:backend_wxagg.py

示例7: draw

    def draw( self ):
        """
        Draw the figure when xwindows is ready for the update
        """

        if DEBUG: print "FigureCanvasQtAgg.draw", self
        self.replot = True
        FigureCanvasAgg.draw(self)
        self.update()
        # Added following line to improve realtime pan/zoom on windows:
        QtGui.qApp.processEvents()
开发者ID:08s011003,项目名称:nupic,代码行数:11,代码来源:backend_qt4agg.py

示例8: paintEvent

    def paintEvent( self, e ):
        """
        Draw to the Agg backend and then copy the image to the qt.drawable.
        In Qt, all drawing should be done inside of here when a widget is
        shown onscreen.
        """

        #FigureCanvasQT.paintEvent( self, e )
        if DEBUG: print 'FigureCanvasQtAgg.paintEvent: ', self, \
           self.get_width_height()

        # only replot data when needed
        if type(self.replot) is bool: # might be a bbox for blitting
            if self.replot:
                FigureCanvasAgg.draw(self)

            # matplotlib is in rgba byte order.  QImage wants to put the bytes
            # into argb format and is in a 4 byte unsigned int.  Little endian
            # system is LSB first and expects the bytes in reverse order
            # (bgra).
            if QtCore.QSysInfo.ByteOrder == QtCore.QSysInfo.LittleEndian:
                stringBuffer = self.renderer._renderer.tostring_bgra()
            else:
                stringBuffer = self.renderer._renderer.tostring_argb()

            qImage = QtGui.QImage(stringBuffer, self.renderer.width,
                                  self.renderer.height,
                                  QtGui.QImage.Format_ARGB32)
            p = QtGui.QPainter(self)
            p.drawPixmap(QtCore.QPoint(0, 0), QtGui.QPixmap.fromImage(qImage))

            # draw the zoom rectangle to the QPainter
            if self.drawRect:
                p.setPen( QtGui.QPen( QtCore.Qt.black, 1, QtCore.Qt.DotLine ) )
                p.drawRect( self.rect[0], self.rect[1], self.rect[2], self.rect[3] )

            p.end()
        # we are blitting here
        else:
            bbox = self.replot
            l, b, r, t = bbox.extents
            w = int(r) - int(l)
            h = int(t) - int(b)
            t = int(b) + h
            reg = self.copy_from_bbox(bbox)
            stringBuffer = reg.to_string_argb()
            qImage = QtGui.QImage(stringBuffer, w, h, QtGui.QImage.Format_ARGB32)
            pixmap = QtGui.QPixmap.fromImage(qImage)
            p = QtGui.QPainter( self )
            p.drawPixmap(QtCore.QPoint(l, self.renderer.height-t), pixmap)
            p.end()
        self.replot = False
        self.drawRect = False
开发者ID:08s011003,项目名称:nupic,代码行数:53,代码来源:backend_qt4agg.py

示例9: __init__

    def __init__(self, figure):

        QtGui.QWidget.__init__(self)
        FigureCanvasAgg.__init__(self, figure)
        self.figure = figure
        self.setMouseTracking(True)

        w,h = self.get_width_height()
        self.resize( w, h )
        self.drawRect = False
        self.rect = []
        self.replot = True
        self.pixmap = QtGui.QPixmap()
开发者ID:BackupTheBerlios,项目名称:simuvis4-svn,代码行数:13,代码来源:backend_sv4agg.py

示例10: _render_figure

    def _render_figure(self, pixmap, width, height):
        if DEBUG: print 'FigureCanvasGTKAgg.render_figure'
        FigureCanvasAgg.draw(self)
        if DEBUG: print 'FigureCanvasGTKAgg.render_figure pixmap', pixmap
        #agg_to_gtk_drawable(pixmap, self.renderer._renderer, None)

        buf = self.buffer_rgba(0,0)
        ren = self.get_renderer()
        w = int(ren.width)
        h = int(ren.height)
        pixbuf = gtk.gdk.pixbuf_new_from_data(
            buf, gtk.gdk.COLORSPACE_RGB,  True, 8, w, h, w*4)
        pixmap.draw_pixbuf(pixmap.new_gc(), pixbuf, 0, 0, 0, 0, w, h, gtk.gdk.RGB_DITHER_NONE, 0, 0)
        if DEBUG: print 'FigureCanvasGTKAgg.render_figure done'
开发者ID:pv,项目名称:matplotlib-cvs,代码行数:14,代码来源:backend_gtkagg.py

示例11: paintEvent

    def paintEvent(self, e):
        """
        Draw to the Agg backend and then copy the image to the qt.drawable.
        In Qt, all drawing should be done inside of here when a widget is
        shown onscreen.
        """
        p = QtGui.QPainter( self )

        # only replot data when needed
        if type(self.replot) is bool: # might be a bbox for blitting
            if (self.replot ):
                #stringBuffer = str( self.buffer_rgba(0,0) )
                FigureCanvasAgg.draw( self )

                # matplotlib is in rgba byte order.
                # qImage wants to put the bytes into argb format and
                # is in a 4 byte unsigned int.  little endian system is LSB first
                # and expects the bytes in reverse order (bgra).
                if ( QtCore.QSysInfo.ByteOrder == QtCore.QSysInfo.LittleEndian ):
                    stringBuffer = self.renderer._renderer.tostring_bgra()
                else:
                    stringBuffer = self.renderer._renderer.tostring_argb()
                qImage = QtGui.QImage(stringBuffer, self.renderer.width,
                                       self.renderer.height,
                                       QtGui.QImage.Format_ARGB32)
                self.pixmap = self.pixmap.fromImage(qImage)
            p.drawPixmap(QtCore.QPoint(0, 0), self.pixmap)

            # draw the zoom rectangle to the QPainter
            if (self.drawRect):
                p.setPen(QtGui.QPen(Qt.black, 1, Qt.DotLine))
                p.drawRect(self.rect[0], self.rect[1], self.rect[2], self.rect[3])

        # we are blitting here
        else:
            bbox = self.replot
            w, h = int(bbox.width), int(bbox.height)
            l, t = bbox.ll().x().get(), bbox.ur().y().get()
            reg = self.copy_from_bbox(bbox)
            stringBuffer = reg.to_string()
            qImage = QtGui.QImage(stringBuffer, w, h, QtGui.QImage.Format_ARGB32)
            self.pixmap = self.pixmap.fromImage(qImage)
            p.drawPixmap(QtCore.QPoint(l, self.renderer.height-t), self.pixmap)

        p.end()
        self.replot = False
        self.drawRect = False
开发者ID:BackupTheBerlios,项目名称:simuvis4-svn,代码行数:47,代码来源:backend_sv4agg.py

示例12: keyPressEvent

 def keyPressEvent(self, event):
     key = self._get_key(event)
     FigureCanvasAgg.key_press_event(self, key)
开发者ID:BackupTheBerlios,项目名称:simuvis4-svn,代码行数:3,代码来源:backend_sv4agg.py

示例13: mousePressEvent

 def mousePressEvent(self, event):
     x = event.pos().x()
     # flipy so y=0 is bottom of canvas
     y = self.figure.bbox.height - event.pos().y()
     button = self.buttond[event.button()]
     FigureCanvasAgg.button_press_event( self, x, y, button )
开发者ID:BackupTheBerlios,项目名称:simuvis4-svn,代码行数:6,代码来源:backend_sv4agg.py

示例14: mouseMoveEvent

 def mouseMoveEvent(self, event):
     x = event.x()
     # flipy so y=0 is bottom of canvas
     y = self.figure.bbox.height - event.y()
     FigureCanvasAgg.motion_notify_event( self, x, y )
开发者ID:BackupTheBerlios,项目名称:simuvis4-svn,代码行数:5,代码来源:backend_sv4agg.py

示例15: keyReleaseEvent

 def keyReleaseEvent(self, event):
     key = self._get_key(event)
     FigureCanvasAgg.key_release_event(self, key)
开发者ID:BackupTheBerlios,项目名称:simuvis4-svn,代码行数:3,代码来源:backend_sv4agg.py


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