join the Figure Friday session on November 29, at noon Eastern Time, to showcase your creation and receive feedback from the community.
There have been thousands of UFO sightings in north America since the 20th century. So this week we will be exploring a data set by the National UFO Reporting Center (Kaggle) on UFO sightings from 1998 to 2014.
Thank you to Chris for the data set suggestion. The sample map below is based on Chris’s post and app.
Things to consider:
- can you improve the sample scatter map built?
- would a different figure tell the data story better?
- can you create a Dash app instead?
Sample scatter map:
Code for sample figure:
import plotly.express as px
import pandas as pd
df = pd.read_csv('https://raw.githubusercontent.com/plotly/Figure-Friday/refs/heads/main/2024/week-47/scrubbed.csv')
df['year'] = pd.to_datetime(df['date posted']).dt.year
# sort dataset by year
df.sort_values(['year'], inplace=True)
# Drop rows with missing values in the following columns
df = df.dropna(subset=["latitude", "longitude", "shape", "year"])
# Convert latitude and longitude columns to numeric, forcing errors to NaN for cleaning
df['latitude'] = pd.to_numeric(df['latitude'], errors='coerce')
df['longitude'] = pd.to_numeric(df['longitude'], errors='coerce')
fig = px.scatter_map(
df,
lat="latitude",
lon="longitude",
color="shape",
animation_frame="year",
map_style="dark",
zoom=3,
title="UFO Sightings by Year and Shape",
hover_data={"latitude": False, "longitude": False, "city":True, "shape": True, "year": True}
)
fig.update_layout(map_center_lon=-100, map_center_lat=40)
fig.show()
Participation Instructions:
- Create - use the weekly data set to build your own Plotly visualization or Dash app. Or, enhance the sample figure provided in this post, using Plotly or Dash.
- Submit - post your creation to LinkedIn or Twitter with the hashtags
#FigureFriday
and#plotly
by midnight Thursday, your time zone. Please also submit your visualization as a new post in this thread. - Celebrate - join the Figure Friday sessions to showcase your creation and receive feedback from the community.
If you prefer to collaborate with others on Discord, join the Plotly Discord channel.
Data Source:
Thank you to National UFO Reporting Center (on Kaggle) for the data.