From 0af3c1472ea154ddf00e5bc8330cc21208f5d168 Mon Sep 17 00:00:00 2001 From: Jasleen Sondhi Date: Fri, 15 Sep 2023 02:12:19 +0530 Subject: [PATCH] added categorical plot for pumpkin colors variety --- 2-Regression/4-Logistic/solution/R/lesson_4.Rmd | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/2-Regression/4-Logistic/solution/R/lesson_4.Rmd b/2-Regression/4-Logistic/solution/R/lesson_4.Rmd index c111bea31..09aca861f 100644 --- a/2-Regression/4-Logistic/solution/R/lesson_4.Rmd +++ b/2-Regression/4-Logistic/solution/R/lesson_4.Rmd @@ -226,6 +226,19 @@ baked_pumpkins %>% theme(legend.position = "none") ``` + +```{r cat plot pumpkins-colors-variety} +# Specify colors for each value of the hue variable +palette <- c(ORANGE = "orange", WHITE = "wheat") + +# Create the bar plot +ggplot(pumpkins, aes(y = Variety, fill = Color)) + + geom_bar(position = "dodge") + + scale_fill_manual(values = palette) + + labs(y = "Variety", fill = "Color") + + theme_minimal() +``` + Now that we have an idea of the relationship between the binary categories of color and the larger group of sizes, let's explore logistic regression to determine a given pumpkin's likely color. ## 3. Build your model