Joh*_*ann 4 python matplotlib legend
我想为图例的两行画一个大括号,如下所示:
我可以使用 pyplot 创建除大括号之外的所有内容
plt.plot([],[],"ro",label="a")
plt.plot([],[],"bo",label="b")
plt.legend(frameon=False,loc="upper left")
plt.annotate("some property",
xy=(0.31, 0.7), xycoords='figure fraction',
xytext=(0.31, 0.79), textcoords='figure fraction',
arrowprops=dict(arrowstyle="-",lw=0
)
)
plt.plot()
Run Code Online (Sandbox Code Playgroud)
任何帮助将不胜感激。
感谢 ImportanceOfBeingErnest 的评论,我意识到简单地添加另一个注释的明显解决方案:
plt.annotate(r"$\}$",fontsize=24,
xy=(0.27, 0.77), xycoords='figure fraction'
)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4263 次 |
| 最近记录: |