Hi,

My boss asked me to provide a list of the source-code distribution per
folder in a project.
Using cloc http://cloc.sourceforge.net/ and some python give me all the numbers.

The problem comes when using pie to display the result, since many folders have
a small distribution, labels are printed ontop of each other making it
impossible to
read.

Using linux-2.6.34 kernel as an example:

----8<----
#!/usr/bin/env python

from pylab import *

#linux-2.6.34
dirs=['arch', 'block', 'crypto', 'Documentation', 'drivers',
'firmware', 'fs', 'include', 'init', 'ipc', 'kernel', 'lib', 'mm',
'net', 'samples', 'scripts', 'security', 'sound', 'tools', 'usr',
'virt']
result=[8433016,1662987,11234,38484,44922,4596534,2048,678518,255574,2289,5478,102723,22516,46726,425009,625,31712,31006,440266,29128,549,3973]

fracs=[100*i/float(result[0]) for i in result[1:]]

#difficult to see all the pie-elements,
for f,l in zip(fracs,dirs):
    print l.rjust(20),round(f,2),'\t%'

# make a square figure and axes
figure(1, figsize=(8,8))
ax = axes([0.1, 0.1, 0.8, 0.8])
p=pie(fracs, labels=dirs)
show()
----8<----

some googling gives this thread:
http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg16191.html

but that doesn't solve the problem, just makes it different...

Anyone know of a solution to this problem?

cheers
//Fredrik

------------------------------------------------------------------------------

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to