## Rows: 973 Columns: 15
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (2): Gender, Workout_Type
## dbl (13): Age, Weight (kg), Height (m), Max_BPM, Avg_BPM, Resting_BPM, Sessi...
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
You can also embed plots, for example:
# Categorize BMI
gym$BMI_Category <- cut(
gym$BMI,
breaks = c(0, 18.5, 24.9, 29.9, Inf),
labels = c("Underweight", "Normal weight", "Overweight", "Obese")
)
# Plot
p1 <- ggplot(gym, aes(x = Age, y = Calories_Burned, color = BMI_Category)) +
geom_point(size = 2) +
scale_y_continuous(breaks = seq(0, 1800, by = 300)) +
scale_colour_manual(values = c("Underweight" = "#3A84FF", "Normal weight" = "#16C300", "Overweight" = "#FFBE49", "Obese" = "#C70000"))
labs(
title = "Age vs. Calories Burned by BMI Categories",
x = "Age",
y = "Calories Burned",
color = "BMI Category"
) +
theme_bw()
## NULL
p2 <- ggplot(gym, aes(Fat_Percentage, Calories_Burned, color = Gender))+
geom_point() +
scale_x_continuous(breaks = seq(10, 35, by = 5)) +
scale_y_continuous(breaks = seq(0, 1800, by = 300)) +
scale_color_manual(values = c("Male" = "#3563FF", "Female" = "#FF3939")) +
labs(title = "Calories Burned by Fat Percentage",
x = "Fat Percentage",
y = "Calories Burned") +
theme_gray() +
theme(plot.title = element_text(size = 14, face = 'bold'),
axis.title.x = element_text(size = 10, face = 'bold'),
axis.title.y = element_text(size = 10, face = 'bold')) +
theme(panel.grid.major = element_line(size = 0.5)) +
theme(panel.grid.minor = element_line(size = .5))
## Warning: The `size` argument of `element_line()` is deprecated as of ggplot2 3.4.0.
## ℹ Please use the `linewidth` argument instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
p3 <- ggplot(gym, aes(x = Gender, y = Calories_Burned, fill = Gender)) +
geom_boxplot() +
scale_y_continuous(breaks = seq(0, 1800, by = 300)) +
scale_fill_manual(values = c("Male" = "#3563FF", "Female" = "#FF3939")) +
labs(
title = "Calories Burned by Gender",
x = "Gender",
y = "Calories Burned"
) +
theme_bw() +
theme(plot.title = element_text(size = 20, face = 'bold'),
axis.title.x = element_text(size = 14, face = 'bold'),
axis.title.y = element_text(size = 14, face = 'bold')) +
theme(panel.grid.major = element_line(size = 0.5)) +
theme(panel.grid.minor = element_blank())
theme(legend.position = "none")
## List of 1
## $ legend.position: chr "none"
## - attr(*, "class")= chr [1:2] "theme" "gg"
## - attr(*, "complete")= logi FALSE
## - attr(*, "validate")= logi TRUE
patch <- (p1 | p2) / p3
patch