Load libraries

library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.1.2     ✔ readr     2.1.4
## ✔ forcats   1.0.0     ✔ stringr   1.5.0
## ✔ ggplot2   3.4.3     ✔ tibble    3.2.1
## ✔ lubridate 1.9.2     ✔ tidyr     1.3.0
## ✔ purrr     1.0.2     
## ── 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(plotly)
## 
## Attaching package: 'plotly'
## 
## The following object is masked from 'package:ggplot2':
## 
##     last_plot
## 
## The following object is masked from 'package:stats':
## 
##     filter
## 
## The following object is masked from 'package:graphics':
## 
##     layout
library(dslabs)
view(stars)
star_plot<- ggplot(stars, aes(x=temp, y=magnitude, color=type)) + 
  geom_point(size=2) +
  labs(title="Physical Properties Of Stars",
       x="Star Surface Temperature (Kelvins)", y="Absolute Magnitude") +
  theme_minimal() +
  scale_color_discrete(name="OBAFGKM Spectral Class")
star_plot

ggplot(stars, aes(x=temp, y=magnitude, color=type)) + 
  geom_point(size=2) +
  geom_text(data=subset(stars, star == "Sun"), aes(label=star), vjust=1.5, hjust=1) +
  labs(title="Physical Properties of Stars",
       x="Star Surface Temperature (Kelvins)", y="Absolute Magnitude (M)") +
  theme_minimal() +
  scale_color_discrete(name="Spectral Class")

For my visualization I decided to use the ‘stars’ dataset inside dslabs. The stars data set details the physical properties of various stars. These physical properties included spectral classes denoted by the OBAFGKM system, surface temperature in Kelvins, star magnitude, and star name. When making my visualization I first loaded all the libraries I would need. I decided I wanted to do a scatter plot because after I viewed the data set I saw that there were only two continuous and quantitative variables. I placed magnitude as my y and temperature as my x value and for each OBAFGKM was a color. I made a simple scatter plot and chose to set the point size to 2 so everything fit and the data did not look too overwhelming. I attempted to render my R markdown while using plotly but I could not get it to work. Without the plotly I thought that the visualization would not be as easily understood. Because of this I decided to go back in my code and specifically label famous stars. This was when viewing my visualization people could make sense of what was going on by having the Sun labeled. Through this people can view the points in relation to the sun. For instance that point is warmer than the Sun or the point for Vega is not as warm as the sun.