Skip to content Skip to sidebar Skip to footer

Matplotlib - Legend With Multiple Axes With Errorbar Object

I am having trouble to get legends on a plot with two axes sets and an errorbar. The code goes as follows: rect = 0.1, 0.1, 0.8, 0.8 fig = p.figure() ax1 = fig.add_axes(rect) erro

Solution 1:

Using the code from this question should work:

h1, l1 = ax1.get_legend_handles_labels()
h2, l2 = ax2.get_legend_handles_labels()
ax1.legend(h1+h2, l1+l2, loc=2)

Post a Comment for "Matplotlib - Legend With Multiple Axes With Errorbar Object"