Closed
Description
When using hatching in a legend, the PDF backend does not draw the hatching if the previous label is empty:
from matplotlib import pyplot as plt
fig = plt.figure()
a = plt.Rectangle([0,0], 0, 0, facecolor="green", hatch="//")
b = plt.Rectangle([0,0], 0, 0, facecolor="blue", hatch="//")
fig.legend([a,b,a,b], ["","","",""])
plt.savefig("test.pdf")
plt.show()
The displayed legend (from plt.show) is:
The legend saved in the PDF is:
If one of the labels is non-empty:
fig.legend([a,b,a,b], ["","","X",""])