Return to Snippet

Revision: 21462
at December 14, 2009 01:13 by enjoydoingitwrong


Initial Code
# Enjoy Doing It Wrong, 2009.
# License: WTFPL

import itertools

# found using stackoverflow.com/users
bounds = [i*35 for i in (3307, 186, 93, 59, 41, 31, 23)] +\
         [19*35+20, 16*35+20, 13*35+20, 12*35+15, 6*35+4, 4*35-4] + [42, 8, 0]

# His stats
joel_stats = [8, 10, 11, 11, 13, 14, 14, 15, 15, 16, 17, 19, 21, 26, 30]
labels = [i for i in (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 30, 50)]

gaps = []
prev = bounds[0]
for bound in bounds:
    gaps.append(prev-bound)
    prev = bound

less_than = gaps[1:-1]

def reputation_repartition(l):
    def careers_subscribers(l):
        return [n*s*.01 for n, s in itertools.izip(l, joel_stats)]
    subscribers = careers_subscribers(l)
    total = sum(subscribers)
    return [i/total*100 for i in subscribers]

reputation = reputation_repartition(less_than))
data = [(str(rep), percent) for rep, percent in itertools.izip(labels, reputation)]

from pychart import *
theme.output_file = "joel_raw.svg"
theme.output_format = "svg"
theme.use_color = True
theme.reinitialize()

ar = area.T(x_axis=axis.X(label="Stack Overflow Reputation"),
            x_coord=category_coord.T(data, 0),
            y_range=(0, None),
            y_axis=axis.Y(label="Careers users (%)"))
ar.add_plot(bar_plot.T(data=data, label="bleh"))

ar.draw()

Initial URL
http://enjoydoingitwrong.wordpress.com/2009/12/14/joel-doing-it-wrong/

Initial Description

                                

Initial Title
Analyzing Joel stats

Initial Tags
python

Initial Language
Python