Skip to content

Instantly share code, notes, and snippets.

@iangelmx
Created June 1, 2020 03:09
Show Gist options
  • Save iangelmx/7a677631a09a46bc570915f4097de2b2 to your computer and use it in GitHub Desktop.
Save iangelmx/7a677631a09a46bc570915f4097de2b2 to your computer and use it in GitHub Desktop.
#Obtenemos los datos de la pivot table y los graficamos
axes = table.plot(kind='bar', rot=15)
#Leyendas en los ejes
axes.set_ylabel('Millones de pruebas realizadas')
axes.set_xlabel('Países')
#Cambiamos escala en Y
axes.set_ylim(0,7000000)
fig = axes.get_figure()
#Cambiamos tamaño de gráfica
fig.set_size_inches(14, 7)
#Iteramos en cada barra para pintar sus valores en la gráfica
for bar in axes.patches:
axes.annotate(
"{:,}".format( bar.get_height() ),
(bar.get_x() * 1.005, bar.get_height() * 1.005)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment