Skip to content
Open
Binary file added 08-31-2022.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Exploring COVID-19 Vaccine Effectiveness
DDD edits
## National View
![](img/animation.gif)

Expand Down
Binary file modified img/05-31-2021.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified img/06-30-2021.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified img/07-31-2021.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified img/08-31-2021.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/08-31-2022.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified img/09-30-2021.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified img/10-31-2021.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified img/11-30-2021.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified img/animation.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 16 additions & 2 deletions src/animation.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import imageio as iio
import os
from datetime import datetime #NEW

def create_gif(filename_save):
"""This function creates a gif animation from a folder of png images
Expand All @@ -14,10 +15,23 @@ def create_gif(filename_save):
"""
#makes a list of im NumPy arrays based on a list of .png images (read from folder)
images = list()

#new code below
#created a dictionary that has datetime objects as keys and values as filenames as strings
newsort=dict()
for file in os.listdir('img'):
try:
newsort[datetime.strptime(file[:10],'%m-%d-%Y')]=file #if filename can be interpreted as datetime object then add it to dictionary w/ key=datetime obj and value=filename
except:
print('')
#sort the dictionary using sorted. Sorted returns a list, so the dict function and the items method are required to get back to the sorted dictionary
newsort=dict(sorted(newsort.items())) #sorts the dictionary by datetime obj keys
#end new code block, but the following for loop loops through newsort values instead of the img drive like it did before

#this part looks at the img directory and reads in all the files that end with .png (only going to bring in those)
for filename in sorted(os.listdir('img')):
if filename[-4:] == '.png' and not filename == 'comparison.png':
for filename in newsort.values(): #loop through dictionary values, which are filenames, loops in order of keys, which have been sorted chronologically
if filename[-4:] == '.png' and not filename == 'comparison.png': #this isn't needed anymore
#print(filename)
f = os.path.join('img',filename)
im = iio.imread(f)
images.append(im)
Expand Down
2 changes: 2 additions & 0 deletions src/scatters.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ def scatter(month):
ax.scatter([], [], s = plot_scl*area_scl, c = "gray", alpha = 0.5, label = str(area_scl) + 'M')
ax.legend(loc = (1.05, 0.3), title="Population (Millions)", labelspacing = 1.5, borderpad = 1)

plt.text(30, 200, month, fontsize = 30).set_alpha(.4)

plt.tight_layout()
plt.savefig('img/'+month+'.png')

Expand Down