# install.packages("ggforce")
# install.packages("scico")
# devtools::install_github("coolbutuseless/ggblur")
g_ext <-
ggplot (df_missions, aes (x = id, y = hours, color = hours)) +
## geom_link() from {ggforce} to draw smooth curves
ggforce:: geom_link (aes (xend = id, yend = 0 , alpha = hours), size = .25 , n = 300 ) +
geom_point (aes (y = 0 ), shape = 15 , size = .1 , color = "#808080" ) +
##geom_point_blur() from {ggblur} to add points with gradual fading
ggblur:: geom_point_blur (aes (size = hours, blur_size = hours), blur_steps = 25 ) +
geom_text (
data = df_labs, aes (y = 0 , label = abs (year)),
family = "Lato" , fontface = "bold" , color = "#808080" ,
size = 4.5 , hjust = 1.2
) +
geom_text (
data = df_max, aes (label = label),
family = "Lato" , size = 3.9 , vjust = - .35
) +
coord_polar (theta = "y" , start = 0 , clip = "off" ) +
scale_x_continuous (limits = c (- 300 , NA ), expand = c (0 , 0 )) +
scale_y_continuous (limits = c (0 , 23000 ), expand = c (0 , 0 )) +
## use custom color palette from {scico}
scico:: scale_color_scico (palette = "buda" ) +
scale_size (range = c (.001 , 3 )) +
ggblur:: scale_blur_size_continuous (range = c (.5 , 10 ), guide = "none" ) +
scale_alpha (range = c (.33 , .95 )) +
annotate (
geom = "text" , x = - 300 , y = 0 , label = "Travelling to \n Outer Space" ,
family = "Boska" , fontface = "bold" , lineheight = .9 ,
size = 20 , color = "white" , hjust = .57 , vjust = .45 , alpha = .25
) +
annotate (
geom = "text" , x = - 300 , y = 0 , label = "Travelling to \n Outer Space" ,
family = "Boska" , fontface = "bold" , lineheight = .85 ,
size = 20 , color = "white" , hjust = .55 , vjust = .4
) +
labs (caption = "Cumulative time in outer space for all 565 cosmonauts and astronauts who participated
in space missions between April 23, 1961 and January 15, 2020, sorted by the year of their first mission.
Graphic: Cédric Scherer • Data: Stavnichuk & Corlett 2020 (DOI: 10.17632/86tsnnbv2w.1)" ) +
theme_void () +
theme (
plot.background = element_rect (fill = "black" ),
plot.margin = margin (- 70 , - 70 , - 70 , - 70 ),
legend.position = "none" ,
plot.caption = element_text (
family = "Lato" ,
size = 15 , color = "#808080" , hjust = .5 ,
margin = margin (- 100 , 0 , 100 , 0 )
)
)