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

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -