library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.1.3     ✔ readr     2.1.4
## ✔ forcats   1.0.0     ✔ stringr   1.5.1
## ✔ ggplot2   3.4.4     ✔ tibble    3.2.1
## ✔ lubridate 1.9.3     ✔ 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
planets <- read.csv("planets.csv")
exoplanets <- read.csv("exoplanets.csv")
planets %>% 
  filter(st_mass < 3) %>% 
  ggplot(aes(pl_pnum, st_mass,color=st_mass)) +
  geom_point() +
  geom_jitter() +
  ggtitle("Stellar Mass vs Planet Number") +
  ylab("Stellar Mass") +
  xlab("Planet Number") +
  theme(legend.position = "none")

planets %>% 
  filter(pl_bmassj < 1) %>% 
  ggplot(aes(pl_bmassj, pl_orbper, color=pl_bmassj)) +
  geom_point() +
  geom_smooth() +
  geom_jitter() +
  ggtitle("Planet Mass vs Orbital Period") +
  xlab("Planet Mass (In Terms of Jupiter)") +
  ylab("Orbital Period (In Earth Days") +
  theme(axis.ticks.y = element_blank())
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 21 rows containing non-finite values (`stat_smooth()`).
## Warning: The following aesthetics were dropped during statistical transformation: colour
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## Warning: Removed 21 rows containing missing values (`geom_point()`).
## Removed 21 rows containing missing values (`geom_point()`).

planets %>% 
  filter(st_teff < 7500 & st_teff > 3000) %>% 
  ggplot(aes(st_optmag, st_teff, color=st_optmag)) +
  geom_point() +
  geom_jitter() +
  ggtitle("Stellar Temperature vs. Magnitude (Brightness)") +
  xlab("Stellar Magnitude") +
  ylab("Stellar Temperature")
## Warning: Removed 52 rows containing missing values (`geom_point()`).
## Removed 52 rows containing missing values (`geom_point()`).

exoplanets %>% 
  ggplot(aes(disc_refname....Discovery.Reference)) +
  geom_bar(fill="purple") +
  ggtitle("Exoplanet Discovery by Year") + 
  xlab("Year of Discovery") +
  ylab("Number of Exoplanets Discovered")

exoplanets %>% 
  filter(sy_disterr1.Distance..pc..Upper.Unc < 1250) %>% 
  ggplot(aes(sy_disterr1.Distance..pc..Upper.Unc, sy_gaiamagerr1..Gaia.Magnitude.Upper.Unc, color=sy_gaiamagerr1..Gaia.Magnitude.Upper.Unc)) +
  geom_point() +
  geom_jitter() +
  ggtitle("System Distance vs. Magnitude") +
  xlab("System Distance (Parsecs)") +
  ylab("Gaia Magnitude") +
  theme(legend.position = "none")
## Warning: Removed 203 rows containing missing values (`geom_point()`).
## Removed 203 rows containing missing values (`geom_point()`).

exoplanets %>%  
  filter(st_denserr1.Stellar.Density.Upper.Unc...g.cm..3. < 50) %>% 
  ggplot(aes(st_ageerr1..Stellar.Age.Upper.Unc...Gyr., st_denserr1.Stellar.Density.Upper.Unc...g.cm..3.)) +
  geom_point(color="purple") +
  ggtitle("Stellar Age vs Stellar Density") +
  xlab("Stellar Age") +
  ylab("Stellar Density")
## Warning: Removed 18591 rows containing missing values (`geom_point()`).

planets %>% 
  filter(st_teff < 20000) %>% 
  ggplot(aes(st_mass, st_teff,color=st_mass)) +
  geom_point() +
  geom_jitter() +
  geom_smooth() +
  ggtitle("Stellar Mass vs Stellar Temperature") +
  xlab("Stellar Mass") +
  ylab("Stellar Temperature")
## `geom_smooth()` using method = 'gam' and formula = 'y ~ s(x, bs = "cs")'
## Warning: Removed 269 rows containing non-finite values (`stat_smooth()`).
## Warning: The following aesthetics were dropped during statistical transformation: colour
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## Warning: Removed 269 rows containing missing values (`geom_point()`).
## Removed 269 rows containing missing values (`geom_point()`).