Skip to content

Instantly share code, notes, and snippets.

@abhijit-c
Created November 14, 2022 17:38
Show Gist options
  • Save abhijit-c/1107eef62eacb0f49014a4f192c2e184 to your computer and use it in GitHub Desktop.
Save abhijit-c/1107eef62eacb0f49014a4f192c2e184 to your computer and use it in GitHub Desktop.
import matplotlib.pyplot as plt
# Population data from https://data.worldbank.org/indicator/SP.POP.TOTL
# Ped. death data estimated from Figure 1 in:
# https://international.fhwa.dot.gov/programs/mrp/docs/FHWAPL2-020_GBP_Ped_Safety%20_Desk_Review_final102822.pdf
dates = [2000, 2010, 2019]
dates = [str(date) for date in dates]
AU = [
(19.15, 282.3104149030503),
(22.03, 169.25140607847925),
(25.37, 155.36721318887794)
]
CA = [
(30.69, 370.9047885795528),
(34.00, 304.128432300995),
(37.60, 314.04370335574845)
]
NL = [
(15.93, 114.37779614311216),
(16.62, 74.0475215590327),
(17.34, 53.5518082458118)
]
NO = [
(4.49, 48.262591906915986),
(4.89, 23.797956758847704),
(5.35, 15.200970627466404)
]
UK = [
(58.89, 887.929704867958),
(62.77, 416.5222699218525),
(66.84, 489.90612746267846)
]
USA = [
(282.2, 4763.263106861964),
(309.3, 4296.150145820198),
(328.3, 6209.18453728149)
]
plt.figure()
plt.plot(dates, [death/pop for (pop, death) in AU], '-y^', label="AU")
plt.plot(dates, [death/pop for (pop, death) in CA], '-y*', label="CA")
plt.plot(dates, [death/pop for (pop, death) in NL], '-gD', label="NL")
plt.plot(dates, [death/pop for (pop, death) in NO], '-m*', label="NO")
plt.plot(dates, [death/pop for (pop, death) in UK], '-rs', label="UK")
plt.plot(dates, [death/pop for (pop, death) in USA], '-rD', label="USA")
plt.xlabel("Year")
plt.ylabel("Fatality Count / Population in Millions")
plt.legend(
fancybox=True,
shadow=True,
ncol=6,
loc="upper center",
bbox_to_anchor=(0.5,1.10)
)
plt.savefig("normalized_ped_deaths.png", bbox_inches="tight", dpi=512)
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment