def draw_legend(self, legend_ax):
# Make a legend with proxy artists
xpos_artist = lines.Line2D([],[], color='orange')
ypos_artist = lines.Line2D([],[], color='limegreen')
numpts_artist = lines.Line2D([],[], color='purple', linewidth=1)
frozen_artist = patches.Rectangle((0,0), 1, 1, fc='lightblue', ec='None')
missing_artist = patches.Rectangle((0,0), 1, 1, fc='yellow', ec='None')
lost_artist = patches.Rectangle((0,0), 1, 1, fc='red', ec='None')
# Place it in center of top "subplot" area
legend_ax.legend(
[xpos_artist, ypos_artist, numpts_artist,
frozen_artist, missing_artist, lost_artist],
['x-pos', 'y-pos', '# Detection pts',
'Frozen', 'Missing', 'Lost'],
loc='center',
fontsize=12,
ncol=4,
)
legend_ax.axis('off')
format_axis(legend_ax)
评论列表
文章目录