Skip to content

Instantly share code, notes, and snippets.

@aniversarioperu
Created October 13, 2013 18:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aniversarioperu/6965803 to your computer and use it in GitHub Desktop.
Save aniversarioperu/6965803 to your computer and use it in GitHub Desktop.
Script para plotear número de proyectos de ley presentados por cada congresista
# -*- coding: utf-8 -*-
import codecs
import prettyplotlib as ppl
import numpy as np
from prettyplotlib import plt
import csv
x = []
y = []
with open("all_authors.csv_bak", "rb") as csvfile:
f = csv.reader(csvfile, delimiter=",")
for row in f:
x.append(row[1].decode("utf-8"))
y.append(row[0])
y = map(int, y)
plt.rc('font', **{'family': 'DejaVu Sans'})
fig, ax = plt.subplots(1, figsize=(20,6))
width = 0.35
ind = np.arange(len(y))
xdata = ind + 0.05 + width
ax.bar(ind, y)
ax.set_xticks(ind + 0.5)
ax.set_xticklabels(x, rotation="vertical")
ax.autoscale()
ax.set_title(u'Ranking de proyectos de ley por congresista',
fontdict = {'fontsize':24}
)
plt.ylabel(u'Número de proyectos de ley', fontdict={'fontsize':18})
plt.xlabel(u'Congresista', fontdict={'fontsize':22})
ppl.bar(ax, np.arange(len(y)), y, grid="y")
fig.tight_layout()
fig.savefig("ranking_congresista.png")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment