3
When generating a graph using the library matplotlib
in Python language in the Jupyter Notebook, I realized that the data presented in it were "reduced" (I think that would be the term) and with a strange nomenclature on top of the Y axis (le7
).
The data generated were between 100,000 and 1,000,000 to perform study tests on the library, since I am a beginner. Below follows the generated graph:
Could I make the "reduced numbers" stick to their "normal" values? What would this nomenclature be le7
? I’m using the library sqlite3
, extracting information from a database from a single file. Below follows the code that was done to generate the graph:
import matplotlib.pyplot as plt
from sqlite3 import *
conn = connect('C:\\Users\\lucas\\Documents\\Bancos\\empresas.db')
c = conn.cursor()
a = c.execute("SELECT empresa, SUM(acoes) FROM empresas GROUP BY empresa;")
empresa = []
acao = []
for i in a:
empresa.append(i[0])
acao.append(i[1])
plt.xlabel('Empresas')
plt.ylabel('Ações')
plt.bar(empresa,acao)
plt.show()
To know about the values, the data that were returned in the database were these:
Thank you very much! Could you also tell me how to put the values on top of each bar of the bar graph? Grateful!
– Lucas Ribeiro
You’ll need to use
plt.annotate
. See if this answer answers your question: https://answall.com/questions/360662/mostrar-valor-dentro-de-uma-barra-com-matplotlib If not, open a new question– Lucas