本文整理汇总了Python中matplotlib.figure.Figure.frameon方法的典型用法代码示例。如果您正苦于以下问题:Python Figure.frameon方法的具体用法?Python Figure.frameon怎么用?Python Figure.frameon使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.figure.Figure
的用法示例。
在下文中一共展示了Figure.frameon方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: marker_image
# 需要导入模块: from matplotlib.figure import Figure [as 别名]
# 或者: from matplotlib.figure.Figure import frameon [as 别名]
def marker_image(path, size, trans,
edgecolor='k', facecolor = 'b',
edgewidth= 1.0):
fig = Figure(figsize=((size*2+1)/72., (size*2+1)/72.), dpi = 72)
#fig.set_edgecolor([1,1,1,0])
#fig.set_facecolor([1,1,1,0])
fig.set_edgecolor([0,0,0,0])
fig.set_facecolor([0,0,0,0])
fig.patch.set_alpha(0.0)
fig.clf()
fig.frameon = False
ax = fig.add_subplot(111)
ax.set_position((0,0,1,1))
ed=ax.transAxes.transform([(0,0), (1,1)])
path = trans.transform_path(path)
patch = patches.PathPatch(path, facecolor=facecolor, edgecolor=edgecolor,
lw=edgewidth)
ax.patch.set_facecolor([0,0,0,0])
ax.patch.set_edgecolor([0,0,0,0])
ax.patch.set_alpha(0.0)
ax.add_patch(patch)
ax.set_xlim(-1,1)
ax.set_ylim(-1,1)
ax.tick_params(length=0)
ax.set_axis_off()
canvas = FigureCanvasAgg(fig)
buff, size = canvas.print_to_buffer()
im = np.fromstring(buff, np.uint8).reshape(size[1], size[0], -1)
#idx = np.where(im[:,:,-1] == 0)
#im[:,:,0][idx] = 0
#im[:,:,1][idx] = 0
#im[:,:,2][idx] = 0
return im