TL;DR: ggsky adds galactic and equatorial sky-map coordinates to ggplot2, so you can plot points, paths, and segments on a Hammer projection with readable sky-grid labels.
library(ggsky)
library(ggplot2)
#> Warning: package 'ggplot2' was built under R version 4.5.2
theme_set(theme_light())geom_pathIt projects geom_path between points along Great circle, i.e., the shortest path on the sky map.
df_path_gal <- data.frame(
l = c(110, 110),
b = c(-4, 60),
g = 1
)
ggplot(df_path_gal, aes(l, b, group = g)) +
geom_path(colour = "blue", linewidth = 1) +
coord_galactic()Use built-in dataset equator.
ggplot(equator, aes(l, b)) +
geom_path(linetype = "dotted", color = "red") +
geom_text(
data = subset(equator, ra %% 30 == 0),
aes(label = sprintf("%d*degree", ra)),
parse = TRUE,
vjust = -0.5,
size = 3,
color = "red"
) +
coord_galactic()