2

Is there a way to display an upper limit symbol in a legend when using matplotlib? The upper limit symbol is missing in this case, when I add a legend. It just shows up as an errorbar.

An example is attached:

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)

Output:

enter image description here

grover
  • 927
  • 1
  • 10
  • 21

0 Answers0