15分钟
Patch类
matplotlib.patches.Patch类是二维图形类。它的基类是matplotlib.artist.Artist。其构造函数为: Patch(edgecolor=None, facecolor=None, color=None, linewidth=None, linestyle=None, antialiased=None, hatch=None, fill=True, capstyle=None, joinstyle=None, **kwargs) 参数为:
edgecolor:可以为matplotlib color,表示边线条的颜色,若为none则表示无颜色facecolor:可以为matplotlib color,表示前景色,若为none则表示无颜色color可以为matplotlib color,表示边线条和前景色的颜色。linewidth:为浮点数,表示线条宽度linestyle:指定线型,可以为以下值:'-'或者'solid':表示实线'--'或者dashed:表示虚线'-.'或者dash_dot:表示点划线':'或者'dotted':表示点线'None'或者' '或者'':表示没有线条(不画线)
antialiased:一个布尔值。如果为True则表示线条是抗锯齿处理的hatch:设置hatching pattern,可以为下列的值:'\'、'|'、'-'、'+'、'x'、'o'、'0'、'.'、'*'
fill:为布尔值。如果为True则填充图形,否则不填充capstyle:为'butt' or 'round' or 'projecting',表示线条头端类型joinstyle:可以为'miter'、'round'、'bevel',表示矩形线条接头类型- 其他关键字参数用于设置属性
如果
edgecolor, facecolor, linewidth, or antialiased为None则这些值从rc params中读取
属性如下:
- 继承自
Artist基类的属性:.alpha、.animated、.axes、.clip_box、..clip_on、.clip_path、.contains、.figure、.gid、.label、path_effects、.picker、.transform、.url、.visible、.zorder .antialiased或者.aa属性:一个布尔值。如果为True则表示线条是抗锯齿处理的.capstyle属性:为'butt' or 'round' or 'projecting',表示线条头端类型.color属性:可以为matplotlib color,表示边线条和前景色的颜色。.edgecolor或者.ec属性:可以为matplotlib color,表示边线条的颜色,若为none则表示无颜色.facecolor或者.fc属性:可以为matplotlib color,表示前景色,若为none则表示无颜色.fill属性:为布尔值。如果为True则填充图形,否则不填充.hatch属性:设置hatching pattern,可以为下列的值:'\'、'|'、'-'、'+'、'x'、'o'、'0'、'.'、'*'
.joinstyle属性:可以为'miter'、'round'、'bevel',表示矩形线条接头类型.linestyle或者.ls属性:指定线型,可以为以下值:'-'或者'solid':表示实线'--'或者dashed:表示虚线'-.'或者dash_dot:表示点划线':'或者'dotted':表示点线'None'或者' '或者'':表示没有线条(不画线)
.linewidth或者.lw属性:为浮点数,表示线条宽度
学员评价