Skip to content

Instantly share code, notes, and snippets.

@brinnaebent
Created November 6, 2020 22:04
Show Gist options
  • Save brinnaebent/9a2f99561e1c193ba22bd42febb7c06e to your computer and use it in GitHub Desktop.
Save brinnaebent/9a2f99561e1c193ba22bd42febb7c06e to your computer and use it in GitHub Desktop.
def plot_map_gif(year):
filterdata = data[data.year == year]
df = pd.DataFrame()
df['lat'] = pd.to_numeric(filterdata['latitude'], errors='coerce')
df['long'] = pd.to_numeric(filterdata['longitude '], errors='coerce')
df = df.dropna()
fig = plt.figure(figsize=(20,10))
plt.rcParams.update({'font.size': 20})
wmap = Basemap(projection='mill', llcrnrlat = -90, urcrnrlat = 90, llcrnrlon = -180, urcrnrlon = 180, resolution='c')
wmap.drawcoastlines()
latarray = np.array(df['lat'])
longarray = np.array(df['long'])
wmap.scatter(longarray, latarray, latlon=True, color='lime', s=20)
plt.title(('Reported UFO Sightings: ' + str(year))) # Add year to title here
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment