# 3-pannel graph showing distributions
g1 <- ggplot(df_merged, aes(x = NtvMamm)) +
geom_histogram(col = "yellow", fill = "yellow", alpha = .7) +
scale_x_continuous(breaks = seq(0, 80, 20), limits = c(0, 80)) +
guides(fill = FALSE, col = FALSE)
## Warning: The `<scale>` argument of `guides()` cannot be `FALSE`. Use "none" instead as
## of ggplot2 3.3.4.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
g2 <- ggplot(df_merged, aes(x = NtvBird)) +
geom_histogram(col = "blue", fill = "blue", alpha = .7) +
scale_x_continuous(breaks = seq(0, 250, 75), limits = c(0, 250)) +
guides(fill = FALSE, col = FALSE)
g3 <- ggplot(df_merged, aes(x = NtvRept)) +
geom_histogram(col = "maroon", fill = "maroon", alpha = .7) +
scale_x_continuous(breaks = seq(0, 50, 10), limits = c(0, 50)) +
guides(fill = FALSE, col = FALSE)
g_all <- ggarrange(g1, g2, g3, ncol=3) %>%
annotate_figure(top = text_grob("Distributions of Birds vs Mammals vs Reptiles"))
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 4 rows containing non-finite outside the scale range
## (`stat_bin()`).
## Warning: Removed 2 rows containing missing values or values outside the scale range
## (`geom_bar()`).
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 2 rows containing missing values or values outside the scale range
## (`geom_bar()`).
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 1 row containing non-finite outside the scale range (`stat_bin()`).
## Removed 2 rows containing missing values or values outside the scale range
## (`geom_bar()`).
g_all

# 3 pannel graph showing relationships
gr1 <- ggplot(df_merged, aes(x = NtvMamm, y = NtvBird)) +
geom_smooth(alpha = .5, method = "lm", se = TRUE, fullrange = TRUE, col = "yellow") +
labs(title = "Relationship Between Mammals & Birds") +
theme(plot.title = element_text(hjust = .5))
gr2 <- ggplot(df_merged, aes(x = NtvMamm, y = NtvRept)) +
geom_smooth(alpha = .5, method = "lm", se = TRUE, fullrange = TRUE, col = "blue") +
labs(title = "Relationship Between Mammals & Reptiles") +
theme(plot.title = element_text(hjust = .5))
gr3 <- ggplot(df_merged, aes(x = NtvBird, y = NtvRept)) +
geom_smooth(alpha = .5, method = "lm", se = TRUE, fullrange = TRUE, col = "maroon") +
labs(title = "Relationship Between Birds & Reptiles") +
theme(plot.title = element_text(hjust = .5))
gr_all <- ggarrange(gr1, gr2, gr3, ncol=1, nrow=3)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
gr_all
