Bram,
 
 
fig = plt.figure()
ax = fig.add_subplot(111)
plot1 = plot.plot(X,Y,label='1')
plot2 = plot.plot(X,Y,label='2')
...
plotN = plot.plot(X,Y,label='N')
 
legend = plt.legend(ncol=2)
 
should work...
 
so, for your "own_plot_function", you have to return the legend and set it 
accordingly...
 
Thomas
 


**********************
Thomas Lecocq 
Geologist
Ph.D.Student (Seismology)
Royal Observatory of Belgium
**********************


 


Date: Tue, 8 Feb 2011 11:25:58 +0100
From: sand...@knmi.nl
To: matplotlib-users@lists.sourceforge.net
Subject: [Matplotlib-users] set ncol for legend


Hi, 

I want to update the number of columns in my legend. How should I do that?

I'm looking for something like:

fig = plt.figure()
ax = fig.add_subplot(111)
my_own_plot_function(ax, data)    # gives, for example, one column legend by 
default
legend = ax.get_legend()
legend.set_ncol(2)          # something like this 


However, ncol is not in the legend.properties() list for properties to be set 
through legend.set.


Thanks for any help, 
Bram 


------------------------------------------------------------------------------ 
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE: 
Pinpoint memory and threading errors before they happen. Find and fix more than 
250 security defects in the development cycle. Locate bottlenecks in serial and 
parallel code that limit performance. http://p.sf.net/sfu/intel-dev2devfeb
_______________________________________________ Matplotlib-users mailing list 
Matplotlib-users@lists.sourceforge.net 
https://lists.sourceforge.net/lists/listinfo/matplotlib-users                   
                     
------------------------------------------------------------------------------
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to