Recently Published
Hertzsprung–Russell Diagram
library(dslabs)
library(ggplot2)
library(scales)
data(stars)
stars$lum <- 10^((4.83 - stars$magnitude) / (100^0.2))
ejes <- ggplot(stars, aes(x = temp, y = lum, color = temp, size = lum)) +
scale_x_log10(trans = "reverse") +
scale_y_log10(labels = trans_format("log10", math_format(10^.x)))
grafico <- ejes + geom_point() +
scale_color_gradientn(
colors = c("#FF0000", "#FF7F00", "#FFFF00", "#FFFFFF", "#0000FF"),
values = rescale(c(0, 2600, 2500, 2600, 3000, 4000, 6000, 7000, 10000, 20000, 10000, 30000, 40000, Inf))
) + labs(x = "Temperatura (K)", y = "Luminosidad (solar)") + theme_dark()
grafico