python - Fill the right column of a matplotlib legend first -


hey trying fit legend onto plot doesn't obscure graph.

import numpy np import matplotlib.pyplot plt  x = np.linspace(0,100,11)  plt.plot(x,-x, label='plot 1') plt.plot(x,-2*x, label='plot 2') plt.plot(x,-3*x, label='plot 3')  leg=plt.legend(ncol=2) leg.get_frame().set_visible(false)  plt.show() 

so in minimum working example, above, want able move 'plot 2' label in legend right column, i.e. directly under 'plot 3'.

any appreciated, thanks.

the legend filling in columns left right. in other words, if trick believing there line (without text or line color in legend), can populate space under 'plot 3'.

import numpy np import matplotlib.pyplot plt pylab import *  x = np.linspace(0,100,11)  plt.plot(x,-x, label='plot 1', color='red') plt.plot(x,-2*x, label='plot 2', color='green') plt.plot(x,-3*x, label='plot 3', color='blue')   line1 = line2d(range(10), range(10), marker='', color="red") line2 = line2d(range(10), range(10), marker='',color="green") line3 = line2d(range(10), range(10), marker='', color="blue") line4 = line2d(range(10), range(10), marker='', color="white") plt.legend((line1,line4, line3,line2),('plot1','','plot3','plot2'),numpoints=1, loc=4,ncol=2)  plt.show() 

Comments

Popular posts from this blog

python - Selenium remoteWebDriver (& SauceLabs) Firefox moseMoveTo action exception -

Ansible warning on jinja2 braces on when -

html - How to custom Bootstrap grid height? -