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


Python FigureCanvasAgg.draw方法代码示例

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


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

示例1: copy_from_bbox

# 需要导入模块: from backend_agg import FigureCanvasAgg [as 别名]
# 或者: from backend_agg.FigureCanvasAgg import draw [as 别名]
 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,代码行数:11,代码来源:backend_qt4agg.py

示例2: draw

# 需要导入模块: from backend_agg import FigureCanvasAgg [as 别名]
# 或者: from backend_agg.FigureCanvasAgg import draw [as 别名]
    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,代码行数:12,代码来源:backend_wxagg.py

示例3: draw

# 需要导入模块: from backend_agg import FigureCanvasAgg [as 别名]
# 或者: from backend_agg.FigureCanvasAgg import draw [as 别名]
 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,代码行数:12,代码来源:backend_qt4agg.py

示例4: draw

# 需要导入模块: from backend_agg import FigureCanvasAgg [as 别名]
# 或者: from backend_agg.FigureCanvasAgg import draw [as 别名]
    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,代码行数:13,代码来源:backend_qt4agg.py

示例5: paintEvent

# 需要导入模块: from backend_agg import FigureCanvasAgg [as 别名]
# 或者: from backend_agg.FigureCanvasAgg import draw [as 别名]
    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,代码行数:55,代码来源:backend_qt4agg.py

示例6: _render_figure

# 需要导入模块: from backend_agg import FigureCanvasAgg [as 别名]
# 或者: from backend_agg.FigureCanvasAgg import draw [as 别名]
    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,代码行数:16,代码来源:backend_gtkagg.py

示例7: paintEvent

# 需要导入模块: from backend_agg import FigureCanvasAgg [as 别名]
# 或者: from backend_agg.FigureCanvasAgg import draw [as 别名]
    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,代码行数:49,代码来源:backend_sv4agg.py

示例8: draw

# 需要导入模块: from backend_agg import FigureCanvasAgg [as 别名]
# 或者: from backend_agg.FigureCanvasAgg import draw [as 别名]
 def draw(self):
     FigureCanvasAgg.draw(self)
开发者ID:CTPUG,项目名称:matplotlib-py3,代码行数:4,代码来源:backend_cocoaagg.py


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