Data 110 HW 8

Author

Ehiggs

library(tidyverse)
library(dslabs)
library(RColorBrewer)
#data(package="dslabs")
data("stars")
star <- stars
head(stars)
            star magnitude temp type
1            Sun       4.8 5840    G
2        SiriusA       1.4 9620    A
3        Canopus      -3.1 7400    F
4       Arcturus      -0.4 4590    K
5 AlphaCentauriA       4.3 5840    G
6           Vega       0.5 9900    A
newstar <-filter(star, "lum" <= 15 & "temp" <= 12000)
plot2 <- star |>
  ggplot(aes(x= temp, y = magnitude, color = type))+
  scale_color_brewer(palette = ("Paired"))+
    geom_point()+
    geom_smooth( lty = 2, color = "white", method= lm, formula = y ~ log(x))+
  labs(x="Temperature", y="Size", color = "Type", title = "Size and Temperature of Stars")+
  theme_minimal()

plot2

I used the “Physical Properties of Stars” data set. I made a scatter plot with a line showing the general trend of stars in how their size relates to their temperature. I also made the color relate to the type of star.

Something interesting about the graph is that the line that shows the trend of the data is almost like a square root function.