有人知道如何在matplotlib的新打印类型eventplot中添加图例吗?在
我尝试过很多事情,但都没有成功,包括:
labels1 = ['red', 'green', 'blue', 'yellow', 'magenta', 'cyan']
ax2.eventplot(data1, colors=colors1, lineoffsets=lineoffsets1,
linelengths=linelengths1, orientation='vertical', label=labels1)
ax2.legend()
这些编辑是在示例代码eventplot上进行的_演示.py发现于 http://matplotlib.org/dev/api/pyplot_api.html#matplotlib.pyplot.eventplot
TL;DR
只是,
ax.legend( list_of_names )
解释
从你的密码里
例如matplotlib.pyplot.eventplot中的示例
^{pr2}$最终结果
相关问题 更多 >
编程相关推荐