本文整理汇总了Python中matplotlib.patches.Polygon.draw方法的典型用法代码示例。如果您正苦于以下问题:Python Polygon.draw方法的具体用法?Python Polygon.draw怎么用?Python Polygon.draw使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.patches.Polygon
的用法示例。
在下文中一共展示了Polygon.draw方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: write_body
# 需要导入模块: from matplotlib.patches import Polygon [as 别名]
# 或者: from matplotlib.patches.Polygon import draw [as 别名]
def write_body(self):
try:
from matplotlib.path import Path
except ImportError:
Path = None
from matplotlib.patches import Circle, Polygon
else:
from matplotlib.patches import Circle, PathPatch
indices = self.X[:, 2].argsort()
for a in indices:
xy = self.X[a, :2]
if a < self.natoms:
r = self.d[a] / 2
if ((xy[1] + r > 0) and (xy[1] - r < self.h) and
(xy[0] + r > 0) and (xy[0] - r < self.w)):
circle = Circle(xy, r, facecolor=self.colors[a])
circle.draw(self.renderer)
else:
a -= self.natoms
c = self.T[a]
if c != -1:
hxy = self.D[c]
if Path is None:
line = Polygon((xy + hxy, xy - hxy))
else:
line = PathPatch(Path((xy + hxy, xy - hxy)))
line.draw(self.renderer)
示例2: draw
# 需要导入模块: from matplotlib.patches import Polygon [as 别名]
# 或者: from matplotlib.patches.Polygon import draw [as 别名]
def draw(self, renderer):
if isSupportedRenderer(renderer):
renderer.use_gl = True
glcanvas = get_glcanvas()
if self.axes is not None:
tag = self.axes
trans = self.axes.transAxes
elif self.figure is not None:
tag = self.figure
trans = self.figure.transFigure
gc = renderer.new_gc()
rgbFace = self._facecolor
gc.set_foreground(self._edgecolor, isRGBA=True)
glcanvas.frame_request(self, trans)
# if not glcanvas.has_vbo_data(self):
glcanvas.start_draw_request(self)
if self._invalidz:
if glcanvas.has_vbo_data(self):
d = glcanvas.get_vbo_data(self)
d[0]['v'].need_update = True
self._invalidz = False
renderer.gl_draw_path(gc, self._verts3d, trans,
rgbFace = rgbFace,
stencil_test = self.do_stencil_test)
# glcanvas.update_gc(self, gc)
glcanvas.end_draw_request()
# else:
# glcanvas.update_gc(self, gc)
gc.restore()
renderer.use_gl = False
finish_gl_drawing(glcanvas, renderer, tag, trans)
else:
Polygon.draw(self, renderer)