Easy web publishing from R
Write
R Markdown
documents in RStudio.
Share them here on RPubs.
(It’s free, and couldn’t be simpler!)
Get Started
Recently Published
Diagrama de Hertzsprung-Russell (n=96)
library(dslabs)
library(ggplot2)
library(scales)
data(stars)
stars$lum <- 10^((4.83 - stars$magnitude) / (100^0.2))
base <- 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 <- base + geom_point() +
scale_color_gradientn(
colors = c("#FF0000", "#FF7F00", "#FFFF00", "#FFFFFF", "#0000FF"),
values = rescale(c(2500, 4000, 6000, 10000, 33600))
) + labs(x = "Temperatura (K)", y = "Luminosidad (solar)") + theme_dark()
grafico