Created
October 16, 2018 20:40
-
-
Save ihavenonickname/fd5499abfbafa6d11f88f5d4b66e5737 to your computer and use it in GitHub Desktop.
This file contains 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 characters
import matplotlib.pyplot as plt | |
PIB = [ | |
('São Paulo', 628064882), | |
('Rio de Janeiro', 299849795), | |
('Brasília', 197432059), | |
('Belo Horizonte', 87656760), | |
('Curitiba', 78892229), | |
('Manaus', 67572523), | |
('Porto Alegre', 63990644), | |
('Fortaleza', 56728828), | |
('Salvador', 56624041), | |
('Recife', 50688395), | |
('Goiânia', 46094735), | |
('Belém', 28706165), | |
('São Luís', 26326087), | |
('Campo Grande', 23902135), | |
('Vitória', 23370919), | |
('Cuiabá', 20525597), | |
('Natal', 19076030), | |
('Maceió', 18302279), | |
('Teresina', 17762266), | |
('João Pessoa', 17462539), | |
('Florianópolis', 17328527), | |
('Aracaju', 14893787), | |
('Porto Velho', 12609918), | |
('Macapá', 8901882), | |
('Rio Branco', 8192366), | |
('Boa Vista', 7339681), | |
('Palmas', 6544297), | |
] | |
IDH = [ | |
('Florianópolis', 0.847), | |
('Vitória', 0.845), | |
('Brasília', 0.824), | |
('Curitiba', 0.823), | |
('Belo Horizonte', 0.810), | |
('Porto Alegre', 0.805), | |
('São Paulo', 0.805), | |
('Goiânia', 0.799), | |
('Rio de Janeiro', 0.799), | |
('Palmas', 0.788), | |
('Cuiabá', 0.785), | |
('Campo Grande', 0.784), | |
('Recife', 0.772), | |
('Aracaju', 0.770), | |
('São Luís', 0.768), | |
('João Pessoa', 0.763), | |
('Natal', 0.763), | |
('Salvador', 0.759), | |
('Fortaleza', 0.754), | |
('Boa Vista', 0.752), | |
('Teresina', 0.751), | |
('Belém', 0.746), | |
('Manaus', 0.737), | |
('Porto Velho', 0.736), | |
('Macapá', 0.733), | |
('Rio Branco', 0.727), | |
('Maceió', 0.721), | |
] | |
def normalizar(lista): | |
maximo = max(x[1] for x in lista) | |
minimo = min(x[1] for x in lista) | |
dif = maximo - minimo | |
return [(valor - minimo) / dif for _, valor in lista] | |
def main(): | |
plt.plot(normalizar(IDH), normalizar(PIB), 'ro') | |
plt.show() | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment