hw 7

library(tidyverse)
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr     1.1.4     ✔ readr     2.1.5
✔ forcats   1.0.0     ✔ stringr   1.5.1
✔ ggplot2   4.0.2     ✔ tibble    3.3.1
✔ 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")

Graph

ggplot(stars, aes(x = temp, y = magnitude, color = type)) +
  geom_point(size = 2.5) +
  labs(
    title = " Temperature vs Magnitude", 
    caption = "Source: dslabs",
    x = "Temperature",
    y = "Magnitude"
    ) +
  scale_color_manual(values = c(
    "A" = "#7FFFD4", 
    "B" = "#EE7600",
    "F" = "#43CD80",
    "G" = "#C1CDC1",
    "K" = "#FFD700",
    "M" = "#1C86EE",
    "O" = "#00EEEE",
    "DA" = "#7A67EE",
    "DB" = "#EE6A50",
    "DF" = "red"
  )) +
   coord_flip()+
  theme_dark()

Essay

The data set I used from dslabs ks “stars”. It contains different types of stars with it being classified by the name of the star, its temperature( which is in kelvin), its magnitude, and the class of the star. Each star has a type and I connect the type to a color so it would be easier to graph. And you can see the type of stars on the graph from the different temperature and magnitude it has. I flipped the x and y axis as it made more sense for me to look at and it really shows the temperature of the stars. The one that has the highest temperature is the star Alnitak as it is the only one that is above 30,000.