Description
Bug report
xref https://stackoverflow.com/questions/62602933/matplotlib-navigation-toolbar-resets-legendstyle
The logic to regenerate the legend in the Qt figure option window discards most of the custom state set on the legend.
Bug summary
The logic that regenerate the legend pulls only ncols and if the legend is draggable
matplotlib/lib/matplotlib/backends/qt_editor/figureoptions.py
Lines 237 to 246 in e73d4e0
but nothing else.
Code for reproduction
import matplotlib .pyplot as plt
fig, ax = plt.subplots()
ax.plot(range(5), label='a')
ax.plot(range(3)[::-1], label='b')
ax.legend(bbox_to_anchor=(0,1.02,1,0.2), loc="lower left", mode="expand", borderaxespad=0, ncol=3)
plt.show()
open the figure options, tick "(Re)-generate legend" and hit OK or apply
Actual outcome
The legend settings are discarded when the figure is re-generated
Expected outcome
The bbox_to_anchor
, loc
,... settings to be re-used.
Matplotlib version
- Operating system: any
- Matplotlib version: 3.2+
- Matplotlib backend (
print(matplotlib.get_backend())
): Qt5Agg (any Qt5 backend) - Python version: Any
installed from source