stacked bar chart

parent 05b70087
16/10/2018
Paulo, Léo
stars: too informal?
---------
não falar dos mapas conceituais como se o leitor já conhecesse.
não precisa detalhar qm fez oq
tentar tirar nomenclatura de estrelas
critérios de classificação não claros
explicitar soma ** + ***
Fechar sessão (paragrafozinho)
Transformar critérios em bullets
......@@ -71,3 +71,39 @@ rects3 = ax.bar(years + width, counts, width, align='center', alpha=0.5, color='
ax.legend((rects1[0], rects2[0], rects3[0]), ('Conference', 'Magazine', 'Journal'))
plt.show()
# STACKED SOURCE TYPES PER YEAR
HEADERS = ['name', 'stars', 'cite', 'source', 'year', 'source_type']
data = pandas.read_csv('papers.csv', sep=';', header=None, names=HEADERS)
serie_conference = data[data.stars != '*'][data.source_type == 'conference'].groupby(['year']).size()
serie_magazine = data[data.stars != '*'][data.source_type == 'magazine'].groupby(['year']).size()
serie_journal = data[data.stars != '*'][data.source_type == 'journal'].groupby(['year']).size()
dfs = [ serie_conference.to_frame(name="conference"),
serie_magazine.to_frame(name="magazine"),
serie_journal.to_frame(name="journal") ]
df = pandas.concat(dfs, axis=1).fillna(0).sort_index()
years = df.index
counts_conference = df['conference'].values
counts_magazine = df['magazine'].values
counts_journal = df['journal'].values
#import IPython; IPython.embed()
fig, ax = plt.subplots()
width = 0.25
rects1 = ax.bar(years, counts_conference, width, align='center', alpha=0.5, color='b')
plt.xlabel('Year')
plt.ylabel('Quantity')
rects2 = ax.bar(years, counts_magazine, width, bottom=counts_conference, align='center', alpha=0.5, color='y', hatch="////")
rects3 = ax.bar(years, counts_journal, width, bottom=counts_conference+counts_magazine, align='center', alpha=0.5, color='r', hatch="----")
ax.legend((rects1[0], rects2[0], rects3[0]), ('Conference', 'Magazine', 'Journal'))
plt.show()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment