使用matplotlib时,有没有办法在图例中显示上限符号?当我添加图例时,在这种情况下缺少上限符号。它只是显示为错误栏。
附上一个例子:
import matplotlib.pyplot as plt
import numpy as np
plt.close("all");
fig = plt.figure()
ax = fig.gca()
line1, = ax.plot([0, 1, 2], [0, 1, 2], "b-")
line2 = ax.errorbar([0, 1, 2], [0, 1, 2], yerr=np.full(3, 0.2),
uplims=True,
marker="None", color="r",
markeredgecolor="r", markerfacecolor="r",
linewidth=1.0, linestyle="None", alpha=0.5)
lns = (line1, line2)
labs = ["line", "upper limit"]
legend = ax.legend(lns, labs, loc=1, numpoints=1, handlelength=1.5,
fontsize=10)
输出: