本文整理汇总了Python中matplotlib.patches.PathPatch.set_linestyle方法的典型用法代码示例。如果您正苦于以下问题:Python PathPatch.set_linestyle方法的具体用法?Python PathPatch.set_linestyle怎么用?Python PathPatch.set_linestyle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.patches.PathPatch
的用法示例。
在下文中一共展示了PathPatch.set_linestyle方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _render_on_subplot
# 需要导入模块: from matplotlib.patches import PathPatch [as 别名]
# 或者: from matplotlib.patches.PathPatch import set_linestyle [as 别名]
def _render_on_subplot(self, subplot):
"""
Render this Bezier path in a subplot. This is the key function that
defines how this Bezier path graphics primitive is rendered in matplotlib's
library.
TESTS::
sage: bezier_path([[(0,1),(.5,0),(1,1)]])
Graphics object consisting of 1 graphics primitive
::
sage: bezier_path([[(0,1),(.5,0),(1,1),(-3,5)]])
Graphics object consisting of 1 graphics primitive
"""
from matplotlib.patches import PathPatch
from matplotlib.path import Path
from sage.plot.misc import get_matplotlib_linestyle
options = dict(self.options())
del options['alpha']
del options['thickness']
del options['rgbcolor']
del options['zorder']
del options['fill']
del options['linestyle']
bpath = Path(self.vertices, self.codes)
bpatch = PathPatch(bpath, **options)
options = self.options()
bpatch.set_linewidth(float(options['thickness']))
bpatch.set_fill(options['fill'])
bpatch.set_zorder(options['zorder'])
a = float(options['alpha'])
bpatch.set_alpha(a)
c = to_mpl_color(options['rgbcolor'])
bpatch.set_edgecolor(c)
bpatch.set_facecolor(c)
bpatch.set_linestyle(get_matplotlib_linestyle(options['linestyle'], return_type='long'))
subplot.add_patch(bpatch)