本文整理汇总了Python中matplotlib.offsetbox.AnchoredOffsetbox.set_clip_on方法的典型用法代码示例。如果您正苦于以下问题:Python AnchoredOffsetbox.set_clip_on方法的具体用法?Python AnchoredOffsetbox.set_clip_on怎么用?Python AnchoredOffsetbox.set_clip_on使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.offsetbox.AnchoredOffsetbox
的用法示例。
在下文中一共展示了AnchoredOffsetbox.set_clip_on方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: anchor_legend
# 需要导入模块: from matplotlib.offsetbox import AnchoredOffsetbox [as 别名]
# 或者: from matplotlib.offsetbox.AnchoredOffsetbox import set_clip_on [as 别名]
def anchor_legend(ax, box, row, col):
anchored = AnchoredOffsetbox(loc=2,
child=box,
pad=0.,
frameon=False,
bbox_to_anchor=(1 + 0.25*col, 1 - 0.054*row),
bbox_transform=ax.transAxes,
)
# Workaround for a bug in matplotlib up to 1.3.1
# https://github.com/matplotlib/matplotlib/issues/2530
anchored.set_clip_on(False)
ax.add_artist(anchored)
示例2: draw_legend
# 需要导入模块: from matplotlib.offsetbox import AnchoredOffsetbox [as 别名]
# 或者: from matplotlib.offsetbox.AnchoredOffsetbox import set_clip_on [as 别名]
def draw_legend(ax, legend, legend_type, legend_title, ith_legend):
children = []
children.append(make_title(legend_title))
viz_handler = legend_viz[legend_type]
legend_items = sorted(legend.items(), key=operator.itemgetter(1))
children += [viz_handler(str(lab), col) for col, lab in legend_items]
box = VPacker(children=children, align="left", pad=0, sep=5)
# TODO: The vertical spacing between the legends isn't consistent. Should be
# padded consistently
anchored_box = AnchoredOffsetbox(loc=6,
child=box, pad=0.,
frameon=False,
#bbox_to_anchor=(0., 1.02),
# Spacing goes here
bbox_to_anchor=(1, 0.8 - 0.35 * ith_legend),
bbox_transform=ax.transAxes,
borderpad=1.,
)
# Workaround for a bug in matplotlib up to 1.3.1
# https://github.com/matplotlib/matplotlib/issues/2530
anchored_box.set_clip_on(False)
return anchored_box