Last active
September 5, 2018 20:55
-
-
Save fcunhaneto/c0253cf8152e19e8db254f7dc0dd48ae to your computer and use it in GitHub Desktop.
Revisions
-
fcunhaneto revised this gist
Sep 5, 2018 . 1 changed file with 13 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -15,10 +15,22 @@ y = idade_sum plt.figure(figsize=(8, 6)) """ sobre a função bar(*args, **kwargs) Parameters: x: As coordenadas x das barras y: A altura (s) das barras Mais em: https://matplotlib.org/api/_as_gen/matplotlib.pyplot.bar.html """ plt.bar(x, y) plt.title('Distribuição de Idades') plt.xlabel('Idade') plt.ylabel('Alunos') plt.xticks(x) # obriga a mostrar todos os números no eixo x plt.savefig('imagens/idades-diagrama-barras.png') plt.close() -
fcunhaneto created this gist
Sep 5, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ import pandas as pd import matplotlib.pyplot as plt df = pd.read_csv('/home/francisco/Projects/Pycharm/' 'matplot-pandas-tutorial/files/questionario.csv') """ Criando um diagrama de barras para os totais de cada idade """ idade = df['Idade'] idade_sum = idade.value_counts() idade_sum = idade_sum.sort_index() x = idade_sum.index y = idade_sum plt.figure(figsize=(8, 6)) plt.bar(x, y) plt.title('Distribuição de Idades') plt.xlabel('Idade') plt.ylabel('Alunos') plt.xticks(x) # obriga a mostrar todos os números no eixo x plt.savefig('imagens/idades-ditribuicao.png') plt.close()