## ----include = FALSE---------------------------------------------------------- knitr::opts_chunk$set( collapse = TRUE, comment = "#>" ) ## ----setup-------------------------------------------------------------------- library(ggsky) library(ggplot2) theme_set(theme_light()) ## ----------------------------------------------------------------------------- ggplot() + coord_galactic() ## ----------------------------------------------------------------------------- N <- 100 df_gal <- data.frame( l = runif(N, 0, 360), b = runif(N, -90, 90) ) ggplot(df_gal, aes(l, b)) + geom_point() + coord_galactic() ## ----------------------------------------------------------------------------- ggplot() + coord_equatorial() ## ----------------------------------------------------------------------------- df1 <- data.frame( ra = runif(N, 0, 360), dec = runif(N, -90, 90) ) ggplot(df1, aes(ra, dec)) + geom_point() + coord_equatorial() ## ----------------------------------------------------------------------------- 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() ## ----------------------------------------------------------------------------- df_seg_eq <- data.frame( x = 30, y = -10, xend = 120, yend = 40 ) ggplot(df_seg_eq) + geom_segment( aes(x = x, y = y, xend = xend, yend = yend), linewidth = 1, colour = "orange", arrow = arrow(type = "closed", length = unit(0.1, "inches")) ) + coord_equatorial() ## ----------------------------------------------------------------------------- df_path_eq <- data.frame( ra = c(0, 60), dec = c(30, 30), g = 1 ) ggplot(df_path_eq, aes(ra, dec, group = g)) + geom_path() + coord_equatorial() + scale_eq_ra(breaks = seq(0, 330, by = 30)) ## ----------------------------------------------------------------------------- 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()