diff --git a/08-31-2022.png b/08-31-2022.png new file mode 100644 index 0000000..af9adee Binary files /dev/null and b/08-31-2022.png differ diff --git a/README.md b/README.md index 392499e..61d848f 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # Exploring COVID-19 Vaccine Effectiveness +DDD edits ## National View ![](img/animation.gif) diff --git a/img/05-31-2021.png b/img/05-31-2021.png index 9645cf8..2aff75a 100644 Binary files a/img/05-31-2021.png and b/img/05-31-2021.png differ diff --git a/img/06-30-2021.png b/img/06-30-2021.png index dbd31ea..6ee51e2 100644 Binary files a/img/06-30-2021.png and b/img/06-30-2021.png differ diff --git a/img/07-31-2021.png b/img/07-31-2021.png index 16fb68f..d875589 100644 Binary files a/img/07-31-2021.png and b/img/07-31-2021.png differ diff --git a/img/08-31-2021.png b/img/08-31-2021.png index 74c4dca..4eeae7c 100644 Binary files a/img/08-31-2021.png and b/img/08-31-2021.png differ diff --git a/img/08-31-2022.png b/img/08-31-2022.png new file mode 100644 index 0000000..af9adee Binary files /dev/null and b/img/08-31-2022.png differ diff --git a/img/09-30-2021.png b/img/09-30-2021.png index d9a5097..a5b060a 100644 Binary files a/img/09-30-2021.png and b/img/09-30-2021.png differ diff --git a/img/10-31-2021.png b/img/10-31-2021.png index 8d057e3..70dbb7f 100644 Binary files a/img/10-31-2021.png and b/img/10-31-2021.png differ diff --git a/img/11-30-2021.png b/img/11-30-2021.png index a34033e..715c5cd 100644 Binary files a/img/11-30-2021.png and b/img/11-30-2021.png differ diff --git a/img/animation.gif b/img/animation.gif index 592bd27..9fa3c24 100644 Binary files a/img/animation.gif and b/img/animation.gif differ diff --git a/src/animation.py b/src/animation.py index ed200b9..ef4ea23 100644 --- a/src/animation.py +++ b/src/animation.py @@ -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 @@ -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) diff --git a/src/scatters.py b/src/scatters.py index 21ba4b2..3d76324 100644 --- a/src/scatters.py +++ b/src/scatters.py @@ -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')