def plot_tags_dist(ax, orgnodes, days=180, num=10):
    event_tags = (e.tags for e in nodes_to_events(
        orgnodes,
        filters=[within_ndays_before(days)],
        eventclass=['closed']))

    counter = {}
    for tags in event_tags:
        for t in tags:
            if t in counter:
                counter[t] += 1
            else:
                counter[t] = 1

    if not counter:
        return
    taglen = max(map(len, counter))
    data = numpy.array(
        list(counter.items()),
        dtype=[('tags', 'S{0}'.format(taglen)), ('count', int)])
    data.sort(order=['count'])
    data = data[::-1][:num]
    x = numpy.arange(len(data))
    ax.bar(x, data['count'], width=1, color='b', alpha=0.3)
    ax.set_xticks(x + 0.5)
    ax.set_xticklabels(data['tags'])
    pylab.setp(ax.get_xticklabels(),
               rotation=90,
               y=0.05,
               horizontalalignment="left",
               verticalalignment='bottom')
dataset/ETHPy150Open tkf/orgviz/orgviz/graphs.py/plot_tags_dist/original