Visualizations

First, load in the data and name the variables accordingly for ease of use.

library(readr)
stars <- read.csv("C:/Users/glwei/OneDrive/Documents/CC Final Project/6 class csv.csv")
names(stars) <- c("Temperature (K)", "Luminosity(L/Lo)", "Radius(R/Ro)", "Absolute magnitude(Mv)", "Star type", "Star color", "Spectral Class")
View(stars)

Load in tidyverse.

library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.1.4     ✔ purrr     1.0.2
## ✔ forcats   1.0.0     ✔ stringr   1.5.1
## ✔ ggplot2   3.5.1     ✔ tibble    3.2.1
## ✔ lubridate 1.9.3     ✔ tidyr     1.3.1
## ── 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

Calculate general summary stats.

summary(stars$`Temperature (K)`)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    1939    3344    5776   10497   15056   40000
summary(stars$`Luminosity(L/Lo)`)
##     Min.  1st Qu.   Median     Mean  3rd Qu.     Max. 
##      0.0      0.0      0.1 107188.4 198050.0 849420.0
summary(stars$`Radius(R/Ro)`)
##      Min.   1st Qu.    Median      Mean   3rd Qu.      Max. 
##    0.0084    0.1027    0.7625  237.1578   42.7500 1948.5000
summary(stars$`Absolute magnitude(Mv)`)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
## -11.920  -6.232   8.313   4.382  13.697  20.060

Let’s make some plots!

# absolute magnitude vs. temperature over star type scatterplot
ggplot(stars, aes(x = `Absolute magnitude(Mv)`, y = `Temperature (K)`, color = `Star type`)) +
  geom_point(alpha = 0.8)

# absolute magnitude vs. temperature over star color scatterplot
ggplot(stars, aes(x = `Absolute magnitude(Mv)`, y = `Temperature (K)`, color = `Star color`)) +
  geom_point(alpha = 0.7)

# absolute magnitude vs. temperature over spectral class scatterplot
ggplot(stars, aes(x = `Absolute magnitude(Mv)`, y = `Temperature (K)`, color = `Spectral Class`)) +
  geom_point(alpha = 0.7)

These plots look an awful lot like the Hertzsprung-Russell Diagram (HR-Diagram)…

# luminosity vs. temperature over star type scatterplot
ggplot(stars, aes(x = `Luminosity(L/Lo)`, y = `Temperature (K)`, color = `Star type`)) +
  geom_point(alpha = 0.8)

# luminosity vs. temperature over spectral class scatterplot
ggplot(stars, aes(x = `Luminosity(L/Lo)`, y = `Temperature (K)`, color = `Spectral Class`)) +
  geom_point(alpha = 0.7)

# radius vs. temperature over star type scatterplot
ggplot(stars, aes(x = `Radius(R/Ro)`, y = `Temperature (K)`, color = `Star type`)) +
  geom_point(alpha = 0.8)

# radius vs. temperature over spectral class scatterplot
ggplot(stars, aes(x = `Radius(R/Ro)`, y = `Temperature (K)`, color = `Spectral Class`)) +
  geom_point(alpha = 0.7)

# radius vs. luminosity over star type scatterplot
ggplot(stars, aes(x = `Radius(R/Ro)`, y = `Luminosity(L/Lo)`, color = `Star type`)) +
  geom_point(alpha = 0.8)

# radius vs. luminosity over spectral class scatterplot
ggplot(stars, aes(x = `Radius(R/Ro)`, y = `Luminosity(L/Lo)`, color = `Spectral Class`)) +
  geom_point(alpha = 0.7)

# boxplot of temperature across spectral class
ggplot(stars, aes(x = `Spectral Class`, y = `Temperature (K)`)) +
  geom_boxplot()

# boxplot of luminosity across spectral class
ggplot(stars, aes(x = `Spectral Class`, y = `Luminosity(L/Lo)`)) +
  geom_boxplot()

# boxplot of radius across spectral class
ggplot(stars, aes(x = `Spectral Class`, y = `Radius(R/Ro)`)) +
  geom_boxplot()

# boxplot of absolute magnitude across spectral class
ggplot(stars, aes(x = `Spectral Class`, y = `Absolute magnitude(Mv)`)) +
  geom_boxplot()

White stars:

# look at white stars
white_stars <- stars %>%
  filter(`Star color` %in% c("White","Whitish"))
white_stars
##   Temperature (K) Luminosity(L/Lo) Radius(R/Ro) Absolute magnitude(Mv)
## 1            7740      4.90000e-04    1.234e-02                  14.02
## 2            7220      1.70000e-04    1.100e-02                  14.23
## 3            8500      5.00000e-04    1.000e-02                  14.50
## 4            9700      7.40000e+01    2.890e+00                   0.16
## 5            8052      8.70000e+00    1.800e+00                   2.42
## 6           10574      1.40000e-04    9.200e-03                  12.02
## 7            7723      1.40000e-04    8.780e-03                  14.81
## 8            8829      5.37493e+05    1.423e+03                 -10.73
## 9            9235      4.04940e+05    1.112e+03                 -11.23
##   Star type Star color Spectral Class
## 1         2      White              A
## 2         2      White              F
## 3         2      White              A
## 4         3    Whitish              B
## 5         3    Whitish              A
## 6         2      White              F
## 7         2      White              A
## 8         5      White              A
## 9         5      White              A
# summary stats
mean(white_stars$`Temperature (K)`)
## [1] 8619.222
mean(white_stars$`Luminosity(L/Lo)`)
## [1] 104724
mean(white_stars$`Radius(R/Ro)`)
## [1] 282.1935
mean(white_stars$`Absolute magnitude(Mv)`)
## [1] 5.577778
sd(white_stars$`Temperature (K)`)
## [1] 1077.175
sd(white_stars$`Luminosity(L/Lo)`)
## [1] 210407.7
sd(white_stars$`Radius(R/Ro)`)
## [1] 564.002
sd(white_stars$`Absolute magnitude(Mv)`)
## [1] 10.84114
summary(white_stars)
##  Temperature (K) Luminosity(L/Lo)  Radius(R/Ro)       Absolute magnitude(Mv)
##  Min.   : 7220   Min.   :     0   Min.   :   0.0088   Min.   :-11.230       
##  1st Qu.: 7740   1st Qu.:     0   1st Qu.:   0.0100   1st Qu.:  0.160       
##  Median : 8500   Median :     0   Median :   0.0123   Median : 12.020       
##  Mean   : 8619   Mean   :104724   Mean   : 282.1935   Mean   :  5.578       
##  3rd Qu.: 9235   3rd Qu.:    74   3rd Qu.:   2.8900   3rd Qu.: 14.230       
##  Max.   :10574   Max.   :537493   Max.   :1423.0000   Max.   : 14.810       
##    Star type      Star color        Spectral Class    
##  Min.   :2.000   Length:9           Length:9          
##  1st Qu.:2.000   Class :character   Class :character  
##  Median :2.000   Mode  :character   Mode  :character  
##  Mean   :2.889                                        
##  3rd Qu.:3.000                                        
##  Max.   :5.000
white_vec <- c(mean(white_stars$`Temperature (K)`),
               mean(white_stars$`Luminosity(L/Lo)`),
               mean(white_stars$`Radius(R/Ro)`),
               mean(white_stars$`Absolute magnitude(Mv)`))

Red stars:

#look at red stars
red_stars <- stars %>%
  filter(`Star color` %in% c("Red"))
head(red_stars)
##   Temperature (K) Luminosity(L/Lo) Radius(R/Ro) Absolute magnitude(Mv)
## 1            3068         0.002400       0.1700                  16.12
## 2            3042         0.000500       0.1542                  16.60
## 3            2600         0.000300       0.1020                  18.70
## 4            2800         0.000200       0.1600                  16.65
## 5            1939         0.000138       0.1030                  20.06
## 6            2840         0.000650       0.1100                  16.98
##   Star type Star color Spectral Class
## 1         0        Red              M
## 2         0        Red              M
## 3         0        Red              M
## 4         0        Red              M
## 5         0        Red              M
## 6         0        Red              M
# summary stats
mean(red_stars$`Temperature (K)`)
## [1] 3291.786
mean(red_stars$`Luminosity(L/Lo)`)
## [1] 60526.79
mean(red_stars$`Radius(R/Ro)`)
## [1] 283.5297
mean(red_stars$`Absolute magnitude(Mv)`)
## [1] 8.173384
sd(red_stars$`Temperature (K)`)
## [1] 490.7808
sd(red_stars$`Luminosity(L/Lo)`)
## [1] 104282.9
sd(red_stars$`Radius(R/Ro)`)
## [1] 558.1493
sd(red_stars$`Absolute magnitude(Mv)`)
## [1] 11.24126
summary(red_stars)
##  Temperature (K) Luminosity(L/Lo)  Radius(R/Ro)       Absolute magnitude(Mv)
##  Min.   :1939    Min.   :     0   Min.   :   0.0570   Min.   :-11.920       
##  1st Qu.:2988    1st Qu.:     0   1st Qu.:   0.1175   1st Qu.: -6.300       
##  Median :3324    Median :     0   Median :   0.2990   Median : 13.095       
##  Mean   :3292    Mean   : 60527   Mean   : 283.5297   Mean   :  8.173       
##  3rd Qu.:3551    3rd Qu.:123750   3rd Qu.:  26.0000   3rd Qu.: 16.890       
##  Max.   :6850    Max.   :363000   Max.   :1673.0000   Max.   : 20.060       
##    Star type      Star color        Spectral Class    
##  Min.   :0.000   Length:112         Length:112        
##  1st Qu.:0.000   Class :character   Class :character  
##  Median :1.000   Mode  :character   Mode  :character  
##  Mean   :1.705                                        
##  3rd Qu.:4.000                                        
##  Max.   :5.000
red_vec <- c(mean(red_stars$`Temperature (K)`),
             mean(red_stars$`Luminosity(L/Lo)`),
             mean(red_stars$`Radius(R/Ro)`),
             mean(red_stars$`Absolute magnitude(Mv)`))

Blue stars:

# look at blue stars
blue_stars <- stars %>%
  filter(`Star color` %in% c("Blue"))
head(blue_stars)
##   Temperature (K) Luminosity(L/Lo) Radius(R/Ro) Absolute magnitude(Mv)
## 1           39000           204000         10.6                  -4.70
## 2           33750           220000         26.0                  -6.10
## 3           36108           198000         10.2                  -4.40
## 4           33300           240000         12.0                  -6.50
## 5           40000           813000         14.0                  -6.23
## 6           23000           127000         36.0                  -5.76
##   Star type Star color Spectral Class
## 1         3       Blue              O
## 2         4       Blue              B
## 3         3       Blue              O
## 4         4       Blue              B
## 5         4       Blue              O
## 6         4       Blue              O
# summary stats
mean(blue_stars$`Temperature (K)`)
## [1] 21955.76
mean(blue_stars$`Luminosity(L/Lo)`)
## [1] 254519.7
mean(blue_stars$`Radius(R/Ro)`)
## [1] 218.7077
mean(blue_stars$`Absolute magnitude(Mv)`)
## [1] -2.631945
sd(blue_stars$`Temperature (K)`)
## [1] 9536.928
sd(blue_stars$`Luminosity(L/Lo)`)
## [1] 217261.6
sd(blue_stars$`Radius(R/Ro)`)
## [1] 499.3799
sd(blue_stars$`Absolute magnitude(Mv)`)
## [1] 7.783249
summary(blue_stars)
##  Temperature (K) Luminosity(L/Lo)  Radius(R/Ro)       Absolute magnitude(Mv)
##  Min.   : 5752   Min.   :     0   Min.   :   0.0093   Min.   :-10.840       
##  1st Qu.:14614   1st Qu.:129000   1st Qu.:   6.6250   1st Qu.: -6.935       
##  Median :19923   Median :224780   Median :  36.0000   Median : -5.990       
##  Mean   :21956   Mean   :254520   Mean   : 218.7077   Mean   : -2.632       
##  3rd Qu.:28606   3rd Qu.:342920   3rd Qu.:  80.5000   3rd Qu.: -4.480       
##  Max.   :40000   Max.   :834042   Max.   :1948.5000   Max.   : 12.900       
##    Star type    Star color        Spectral Class    
##  Min.   :2.0   Length:55          Length:55         
##  1st Qu.:3.0   Class :character   Class :character  
##  Median :4.0   Mode  :character   Mode  :character  
##  Mean   :3.6                                        
##  3rd Qu.:4.0                                        
##  Max.   :5.0
blue_vec <- c(mean(blue_stars$`Temperature (K)`),
              mean(blue_stars$`Luminosity(L/Lo)`),
              mean(blue_stars$`Radius(R/Ro)`),
              mean(blue_stars$`Absolute magnitude(Mv)`))

Blue-white stars:

# look at blue-white stars
bluew_stars <- stars %>%
  filter(`Star color` %in% c("Blue-white", "Blue white", "Blue White"))
head(bluew_stars)
##   Temperature (K) Luminosity(L/Lo) Radius(R/Ro) Absolute magnitude(Mv)
## 1           25000        5.600e-02       0.0084                  10.58
## 2           16500        1.300e-02       0.0140                  11.89
## 3            8570        8.100e-04       0.0097                  14.20
## 4           30000        2.884e+04       6.3000                  -4.20
## 5           15276        1.136e+03       7.2000                  -1.97
## 6           17200        9.800e-04       0.0150                  12.45
##   Star type Star color Spectral Class
## 1         2 Blue White              B
## 2         2 Blue White              B
## 3         2 Blue white              A
## 4         3 Blue-white              B
## 5         3 Blue-white              B
## 6         2 Blue White              B
# summary stats
mean(bluew_stars$`Temperature (K)`)
## [1] 16979.82
mean(bluew_stars$`Luminosity(L/Lo)`)
## [1] 72437
mean(bluew_stars$`Radius(R/Ro)`)
## [1] 195.2651
mean(bluew_stars$`Absolute magnitude(Mv)`)
## [1] 1.774333
sd(bluew_stars$`Temperature (K)`)
## [1] 6559.852
sd(bluew_stars$`Luminosity(L/Lo)`)
## [1] 189603
sd(bluew_stars$`Radius(R/Ro)`)
## [1] 474.1923
sd(bluew_stars$`Absolute magnitude(Mv)`)
## [1] 8.150624
summary(bluew_stars)
##  Temperature (K) Luminosity(L/Lo)  Radius(R/Ro)       Absolute magnitude(Mv)
##  Min.   : 8570   Min.   :     0   Min.   :   0.0084   Min.   :-9.900        
##  1st Qu.:12054   1st Qu.:     0   1st Qu.:   0.0104   1st Qu.:-3.890        
##  Median :14520   Median :   883   Median :   5.8560   Median :-1.970        
##  Mean   :16980   Mean   : 72437   Mean   : 195.2651   Mean   : 1.774        
##  3rd Qu.:22181   3rd Qu.: 14510   3rd Qu.:   6.7100   3rd Qu.:11.560        
##  Max.   :30000   Max.   :849420   Max.   :1779.0000   Max.   :14.870        
##    Star type      Star color        Spectral Class    
##  Min.   :2.000   Length:39          Length:39         
##  1st Qu.:2.000   Class :character   Class :character  
##  Median :3.000   Mode  :character   Mode  :character  
##  Mean   :2.974                                        
##  3rd Qu.:3.000                                        
##  Max.   :5.000
bw_vec <- c(mean(bluew_stars$`Temperature (K)`),
            mean(bluew_stars$`Luminosity(L/Lo)`),
            mean(bluew_stars$`Radius(R/Ro)`),
            mean(bluew_stars$`Absolute magnitude(Mv)`))

Orange stars:

# look at orange stars
orange_stars <- stars %>%
  filter(`Star color` %in% c("Orange"))
head(orange_stars)
##   Temperature (K) Luminosity(L/Lo) Radius(R/Ro) Absolute magnitude(Mv)
## 1            3749           550000         1648                  -8.05
## 2            4287           630000         1315                  -9.20
##   Star type Star color Spectral Class
## 1         5     Orange              M
## 2         5     Orange              K
# summary stats
mean(orange_stars$`Temperature (K)`)
## [1] 4018
mean(orange_stars$`Luminosity(L/Lo)`)
## [1] 590000
mean(orange_stars$`Radius(R/Ro)`)
## [1] 1481.5
mean(orange_stars$`Absolute magnitude(Mv)`)
## [1] -8.625
sd(orange_stars$`Temperature (K)`)
## [1] 380.4234
sd(orange_stars$`Luminosity(L/Lo)`)
## [1] 56568.54
sd(orange_stars$`Radius(R/Ro)`)
## [1] 235.4666
sd(orange_stars$`Absolute magnitude(Mv)`)
## [1] 0.8131728
summary(orange_stars)
##  Temperature (K) Luminosity(L/Lo)  Radius(R/Ro)  Absolute magnitude(Mv)
##  Min.   :3749    Min.   :550000   Min.   :1315   Min.   :-9.200        
##  1st Qu.:3884    1st Qu.:570000   1st Qu.:1398   1st Qu.:-8.912        
##  Median :4018    Median :590000   Median :1482   Median :-8.625        
##  Mean   :4018    Mean   :590000   Mean   :1482   Mean   :-8.625        
##  3rd Qu.:4152    3rd Qu.:610000   3rd Qu.:1565   3rd Qu.:-8.338        
##  Max.   :4287    Max.   :630000   Max.   :1648   Max.   :-8.050        
##    Star type  Star color        Spectral Class    
##  Min.   :5   Length:2           Length:2          
##  1st Qu.:5   Class :character   Class :character  
##  Median :5   Mode  :character   Mode  :character  
##  Mean   :5                                        
##  3rd Qu.:5                                        
##  Max.   :5
orange_vec <- c(mean(orange_stars$`Temperature (K)`),
                mean(orange_stars$`Luminosity(L/Lo)`),
                mean(orange_stars$`Radius(R/Ro)`),
                mean(orange_stars$`Absolute magnitude(Mv)`))

Yellow stars:

# look at yellow-white and yellow stars
yellow_stars <- stars %>%
  filter(`Star color` %in% c("Yellowish White", "yellow-white", "White-Yellow", "Yellowish", "yellowish"))
head(yellow_stars)
##   Temperature (K) Luminosity(L/Lo) Radius(R/Ro) Absolute magnitude(Mv)
## 1           12990         0.000085      0.00984                  12.23
## 2            7700         0.000110      0.01280                  14.47
## 3           11790         0.000150      0.01100                  12.59
## 4            5800         0.810000      0.90000                   5.05
## 5            6757         1.430000      1.12000                   2.41
## 6            6380         1.350000      0.98000                   2.93
##   Star type      Star color Spectral Class
## 1         2 Yellowish White              F
## 2         2 Yellowish White              F
## 3         2 Yellowish White              F
## 4         3    yellow-white              F
## 5         3    yellow-white              F
## 6         3    yellow-white              F
# summary stats
mean(yellow_stars$`Temperature (K)`)
## [1] 6992.867
mean(yellow_stars$`Luminosity(L/Lo)`)
## [1] 1.608109
mean(yellow_stars$`Radius(R/Ro)`)
## [1] 0.8074427
mean(yellow_stars$`Absolute magnitude(Mv)`)
## [1] 6.514933
sd(yellow_stars$`Temperature (K)`)
## [1] 2507.866
sd(yellow_stars$`Luminosity(L/Lo)`)
## [1] 2.891374
sd(yellow_stars$`Radius(R/Ro)`)
## [1] 0.5641021
sd(yellow_stars$`Absolute magnitude(Mv)`)
## [1] 4.670815
summary(yellow_stars)
##  Temperature (K) Luminosity(L/Lo)    Radius(R/Ro)     Absolute magnitude(Mv)
##  Min.   : 4077   Min.   :0.000085   Min.   :0.00984   Min.   :-0.980        
##  1st Qu.: 5444   1st Qu.:0.042645   1st Qu.:0.40390   1st Qu.: 3.695        
##  Median : 6380   Median :0.590000   Median :0.91000   Median : 5.050        
##  Mean   : 6993   Mean   :1.608109   Mean   :0.80744   Mean   : 6.515        
##  3rd Qu.: 7710   3rd Qu.:1.353500   3rd Qu.:1.11300   3rd Qu.: 9.368        
##  Max.   :12990   Max.   :9.250000   Max.   :1.93000   Max.   :14.470        
##    Star type      Star color        Spectral Class    
##  Min.   :2.000   Length:15          Length:15         
##  1st Qu.:2.500   Class :character   Class :character  
##  Median :3.000   Mode  :character   Mode  :character  
##  Mean   :2.733                                        
##  3rd Qu.:3.000                                        
##  Max.   :3.000
yellow_vec <- c(mean(yellow_stars$`Temperature (K)`),
                mean(yellow_stars$`Luminosity(L/Lo)`),
                mean(yellow_stars$`Radius(R/Ro)`),
                mean(yellow_stars$`Absolute magnitude(Mv)`))

New dataframe of means of other variables based on star color.

# new dataframe
means <- data.frame(white_vec, red_vec, blue_vec, bw_vec, orange_vec, yellow_vec)
colnames(means) <- c("White", "Red", "Blue", "Blue-white", "Orange", "Yellow")
rownames(means) <- c("Temperature(K)", "Luminosity(L/Lo)", "Radius(R/Ro)", "Absolute Magnitude(Mv)")
# reshape dataframe
means <- means %>%
  rownames_to_column(var = "Metric") %>%
  pivot_longer(cols = -Metric, names_to = "Color", values_to = "Value")
means <- means %>%
  pivot_wider(names_from = Metric, values_from = Value)
head(means)
## # A tibble: 6 × 5
##   Color      `Temperature(K)` `Luminosity(L/Lo)` `Radius(R/Ro)`
##   <chr>                 <dbl>              <dbl>          <dbl>
## 1 White                 8619.          104724.          282.   
## 2 Red                   3292.           60527.          284.   
## 3 Blue                 21956.          254520.          219.   
## 4 Blue-white           16980.           72437.          195.   
## 5 Orange                4018           590000          1482.   
## 6 Yellow                6993.               1.61          0.807
## # ℹ 1 more variable: `Absolute Magnitude(Mv)` <dbl>

More plots!

# temperature over color
ggplot(means, aes(x = Color, y = `Temperature(K)`), color = Color) +
  geom_point(alpha = 0.7) +
  labs(title = "Scatter Plot of Star Color vs. Temperature",
       x = "Star Color",
       y = "Temperature (K)") +
  theme_minimal()

# luminosity over color
ggplot(means, aes(x = Color, y = `Luminosity(L/Lo)`), color = Color) +
  geom_point(alpha = 0.7) +
  labs(title = "Scatter Plot of Star Color vs. Luminosity",
       x = "Star Color",
       y = "Luminosity (L/Lo)") +
  theme_minimal()

# radius over color
ggplot(means, aes(x = Color, y = `Radius(R/Ro)`), color = Color) +
  geom_point(alpha = 0.7) +
  labs(title = "Scatter Plot of Star Color vs. Radius",
       x = "Star Color",
       y = "Radius (R/Ro)") +
  theme_minimal()

# absolute magnitude over color
ggplot(means, aes(x = Color, y = `Absolute Magnitude(Mv)`), color = Color) +
  geom_point(alpha = 0.7) +
  labs(title = "Scatter Plot of Star Color vs. Absolute Magnitude",
       x = "Star Color",
       y = "Absolute Magnitude (Mv)") +
  theme_minimal()

Create pairs dataset for pairs plot.

# pairs
pairs_data <- means
  pairs_data$Color <- as.factor(pairs_data$Color)
  levels(pairs_data$Color) <- 
  c("White", "Red", "Blue4", "Blue", "Orange", "Yellow3")
pairs_data
## # A tibble: 6 × 5
##   Color   `Temperature(K)` `Luminosity(L/Lo)` `Radius(R/Ro)`
##   <fct>              <dbl>              <dbl>          <dbl>
## 1 Orange             8619.          104724.          282.   
## 2 Blue               3292.           60527.          284.   
## 3 White             21956.          254520.          219.   
## 4 Red               16980.           72437.          195.   
## 5 Blue4              4018           590000          1482.   
## 6 Yellow3            6993.               1.61          0.807
## # ℹ 1 more variable: `Absolute Magnitude(Mv)` <dbl>
custom <- c("Blue4" = "blue4", "Blue" = "blue", 
             "Orange" = "orange", "Red" = "red", 
             "White" = "white", "Yellow3" = "yellow3")

Plot pairs.

pairs(pairs_data[, 2:5],
      main = "Pairs Plot of Means Dataset",
      pch = 21,
      bg = custom[pairs_data$Color])

Even more plots!!

# temperature vs. luminosity over color
ggplot(means, aes(`Temperature(K)`, `Luminosity(L/Lo)`, color = Color)) +
  geom_point() +
  scale_color_manual(values = c("Blue" = "blue4", "Blue-white" = "blue", 
                                "Orange" = "orange", "Red" = "red", 
                                "White" = "black", "Yellow" = "yellow3")) +
  labs(title = "Scatter Plot of Star Temperature vs. Luminosity",
       x = "Temperature (K)",
       y = "Luminosity (L/Lo)") +
  theme_minimal()

# temperature vs. radius over color
ggplot(means, aes(`Temperature(K)`, `Radius(R/Ro)`, color = Color)) +
  geom_point() + 
  scale_color_manual(values = c("Blue" = "blue4", "Blue-white" = "blue", 
                                "Orange" = "orange", "Red" = "red", 
                                "White" = "black", "Yellow" = "yellow3")) +
  labs(title = "Scatter Plot of Star Temperature vs. Radius",
       x = "Temperature (K)",
       y = "Radius (R/Ro)") +
  theme_minimal()