Guest User

Untitled

a guest
Nov 12th, 2021
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. import matplotlib.pyplot as plt
  2. import matplotlib.dates as mdates
  3. import datetime
  4. plt.rcParams["figure.figsize"] = [20, 10]
  5. font = {'family' : 'serif',
  6. 'serif' : 'Times New Roman',
  7. 'size' : 40}
  8. plt.rc('font', **font)
  9. string_dates = ["31/07/2021", "31/08/2021", "30/09/2021", "20/10/2021", "22/10/2021", "24/10/2021",
  10. "29/10/2021", "01/11/2021", "03/11/2021", "05/11/2021", "08/11/2021", "10/11/2021"]
  11. migrants = [26, 500, 1903, 5665, 6162, 6657, 7300, 7832, 8059, 8407, 8833, 9087]
  12. dates = [datetime.datetime.strptime(d,"%d/%m/%Y").date() for d in string_dates]
  13. ax = plt.gca()
  14. formatter = mdates.DateFormatter("%Y-%m-%d")
  15. ax.xaxis.set_major_formatter(formatter)
  16. locator = mdates.MonthLocator()
  17. ax.xaxis.set_major_locator(locator)
  18. plt.title('Migranci z Białorusi przez Polskę stwierdzeni przez Niemcy')
  19. plt.xlabel('Data')
  20. plt.ylabel('Skumulowana liczba \n migrantów od początku roku')
  21. font = {'family' : 'serif',
  22. 'serif' : 'Times New Roman',
  23. 'size' : 18}
  24. plt.rc('font', **font)
  25. plt.text(datetime.datetime.strptime("31/07/2021","%d/%m/%Y").date(), 8000,
  26. 'Źródło: https://www.bundespolizei.de/Web/DE/04Aktuelles/01Meldungen/2021/10/staendige_aktualisierung_migrationslage.html \n'
  27. 'i podane tam wczesniejsze komunikaty policji federalnej')
  28. plt.plot(dates, migrants)
  29. plt.show()
Advertisement
Add Comment
Please, Sign In to add comment