You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ncol is always set to None, except for cases of an already existing legend. Inside the axes.legend method, internally ncol is set to 1 if the number of handles (which is the list of artists (lines, patches) to be added to the legend) is less than 2. So setting ncol=None inside figure_edit works when the number of plots is less than 2, but not instead, since ncol is already set to None.
Steps to reproduce in interactive mode in ipython (pylab loaded) with qt backend:
>>>ax.subplot(111)
>>>x=arange(100)
>>>y=sin(x)
>>>ax.plot(x, y, label="1")
>>>ax.plot(x, y, label="2")
>>>ax.plot(x, y, label="3")
>>>ax.plot(x, y, label="4")
>>>ax.plot(x, y, label="5")
then select in the figure options panel to generate a legend, then apply.
I started to write a PR with an option in the panel, next to the legend generation for the number of columns, but thought that someone has surely a better idea than this...
The text was updated successfully, but these errors were encountered:
Trying to generate a legend from the figure options panel (in the qt backend) when there is more than 2 plots on the graph raise a exception.
Problem comes from this part of the code inside matplotlib/backends/qt_editor/figureoptions.py for the figure_edit function:
ncol is always set to None, except for cases of an already existing legend. Inside the axes.legend method, internally ncol is set to 1 if the number of handles (which is the list of artists (lines, patches) to be added to the legend) is less than 2. So setting ncol=None inside figure_edit works when the number of plots is less than 2, but not instead, since ncol is already set to None.
Steps to reproduce in interactive mode in ipython (pylab loaded) with qt backend:
then select in the figure options panel to generate a legend, then apply.
I started to write a PR with an option in the panel, next to the legend generation for the number of columns, but thought that someone has surely a better idea than this...
The text was updated successfully, but these errors were encountered: