Skip to content

Commit

Permalink
heat map update
Browse files Browse the repository at this point in the history
  • Loading branch information
jishnumds committed Dec 13, 2024
1 parent eada2a5 commit 5129ca0
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions index.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -332,12 +332,16 @@ This map highlights earthquake density by country, allowing users to explore reg
## Earthquake density heatmap

```{r}
# Earthquake density heatmap
# Extract coordinates from quake_sf
quake_coords <- as.data.frame(st_coordinates(quake_sf)) %>%
cbind(mag = quake_sf$mag)
# Plot earthquake density heatmap
ggplot() +
geom_sf(data = world, fill = "lightgray", color = "white") +
stat_density2d(
data = quake_sf,
aes(x = st_coordinates(quake_sf)[, 1], y = st_coordinates(quake_sf)[, 2], fill = ..level..),
data = quake_coords,
aes(x = X, y = Y, fill = ..level..),
geom = "polygon", alpha = 0.6
) +
scale_fill_viridis_c(name = "Density") +
Expand Down

0 comments on commit 5129ca0

Please sign in to comment.