How to apply MarkerStyle transformation to the legend

When I transform a MarkerStyle, it displays fine in the plot but not in the legend:

import matplotlib.pyplot as ppl
from matplotlib.markers import MarkerStyle

hdiamond = MarkerStyle("d")
hdiamond._transform.rotate_deg(90)
ppl.plot(0, 0, marker = hdiamond, label = 'foo', ls = 'None')
ppl.legend()
ppl.show()

This results in:

Screen Shot 2021-07-09 at 13.33.33

How can I correct the problem?

This looks like a bug to me, you can open an issue on the tracker (Issues · matplotlib/matplotlib · GitHub).

It’s now done, thanks.

For reference, this is fixed in 3.4.2.