DSlabs Khan

library(tidyverse)
Warning: package 'ggplot2' was built under R version 4.5.2
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr     1.1.4     ✔ readr     2.1.5
✔ forcats   1.0.1     ✔ stringr   1.5.2
✔ ggplot2   4.0.3     ✔ tibble    3.3.0
✔ lubridate 1.9.4     ✔ tidyr     1.3.1
✔ purrr     1.1.0     
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag()    masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(dslabs)
data(stars)
stars_graph <- stars %>%
  select(star, magnitude, temp, type)
ggplot(stars_graph, aes(x = temp, y = magnitude, color = type)) +
  geom_point() +
  labs(title = "Star Temperature & Magnitude by Type",
    x = "Temperature",
    y = "Magnitude",
    color = "Star Type",
    caption = "Data source: dslabs stars dataset"
  ) +
  theme_dark()

#Thoughts-

I chose the stars data set as I was intriuged to interact with astrological data. To create the graph I first used the DYLPR commands to select the variables I needed, which in this case I needed all 4 columns. Then I created a scatter plot comparing star temperature and magnitude , having each color of data represents the type of star.I then added a legend to note the differences between stars and changed the theme to dark so the data contrasted better.