本文整理汇总了Python中matplotlib.figure.Figure.get_edgecolor方法的典型用法代码示例。如果您正苦于以下问题:Python Figure.get_edgecolor方法的具体用法?Python Figure.get_edgecolor怎么用?Python Figure.get_edgecolor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.figure.Figure
的用法示例。
在下文中一共展示了Figure.get_edgecolor方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: PlotWidget
# 需要导入模块: from matplotlib.figure import Figure [as 别名]
# 或者: from matplotlib.figure.Figure import get_edgecolor [as 别名]
#.........这里部分代码省略.........
self.allocation.width, self.allocation.height)
renderer = RendererCairo(self.figure.dpi)
renderer.set_width_height(self.allocation.width, self.allocation.height)
renderer.set_ctx_from_surface(self.cached_contents)
self.figure.draw(renderer)
# event.region is not bound: http://bugzilla.gnome.org/show_bug.cgi?id=487158
# gdk_context = gtk.gdk.CairoContext(renderer.ctx)
# gdk_context.region(event.region)
# gdk_context.clip()
cr.set_source_surface(self.cached_contents, 0, 0)
cr.paint()
def do_size_allocate(self, allocation):
if allocation.width != self.allocation.width or allocation.height != self.allocation.height:
self.cached_contents = None
gtk.DrawingArea.do_size_allocate(self, allocation)
def do_unrealize(self):
gtk.DrawingArea.do_unrealize(self)
self.cached_contents = None
def do_button_press_event(self, event):
if event.button == 3:
custom_result.show_menu(self, event, save_callback=self.__save)
return True
else:
return True
def do_button_release_event(self, event):
return True
def do_realize(self):
gtk.DrawingArea.do_realize(self)
cursor = gtk.gdk.Cursor(gtk.gdk.LEFT_PTR)
self.window.set_cursor(cursor)
def do_size_request(self, requisition):
try:
# matplotlib < 0.98
requisition.width = self.figure.bbox.width()
requisition.height = self.figure.bbox.height()
except TypeError:
# matplotlib >= 0.98
requisition.width = self.figure.bbox.width
requisition.height = self.figure.bbox.height
def recompute_figure_size(self):
width = (self.sidebar_width / self.figure.dpi)
height = width / DEFAULT_ASPECT_RATIO
self.figure.set_figwidth(width)
self.figure.set_figheight(height)
self.queue_resize()
def sync_dpi(self, dpi):
self.figure.set_dpi(dpi)
if self.sidebar_width >= 0:
self.recompute_figure_size()
def set_sidebar_width(self, width):
if self.sidebar_width == width:
return
self.sidebar_width = width
if self.sidebar_width >= 0:
self.recompute_figure_size()
def sync_style(self, style):
self.cached_contents = None
matplotlib.rcParams['font.size'] = self.parent.style.font_desc.get_size() / pango.SCALE
def __save(self, filename):
# The save/restore here was added to matplotlib's after 0.90. We duplicate
# it for compatibility with older versions. (The code would need modification
# for 0.98 and newer, which is the reason for the particular version in the
# check)
version = [int(x) for x in matplotlib.__version__.split('.')]
need_save = version[:2] < [0, 98]
if need_save:
orig_dpi = self.figure.dpi.get()
orig_facecolor = self.figure.get_facecolor()
orig_edgecolor = self.figure.get_edgecolor()
try:
self.canvas.print_figure(filename)
finally:
if need_save:
self.figure.dpi.set(orig_dpi)
self.figure.set_facecolor(orig_facecolor)
self.figure.set_edgecolor(orig_edgecolor)
self.figure.set_canvas(self.canvas)