From 5c7b7e37b05431a2e533cd7fcd6b764e4678b387 Mon Sep 17 00:00:00 2001 From: Nick Heppler Date: Tue, 18 Feb 2025 19:20:48 -0500 Subject: [PATCH] Modify histogram --- report.Rmd | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/report.Rmd b/report.Rmd index 7378ecf..36ca353 100644 --- a/report.Rmd +++ b/report.Rmd @@ -107,6 +107,14 @@ The histogram presented below visualizes the number of survey submissions based This chart helps identify any trends in survey participation, such as whether submissions are more frequent at the beginning or end of the week. This could be valuable for understanding user behavior and improving survey timing or outreach strategies. ```{r submission-histogram-survey-submissions-day-of-week, echo=TRUE, message=FALSE, fig.height=6, fig.width=8} +# Define custom color palette +my_colors <- c( + primary = "#233f28", + secondary = "#7e9084", + tertiary = "#d9e1dd", + accent = "#face00" +) + library(dplyr) library(ggplot2) @@ -115,11 +123,15 @@ survey_data %>% mutate(DayOfWeek = factor(weekdays(CreationDate), levels = c("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"))) %>% # Set order of days ggplot(aes(x = DayOfWeek)) + - geom_bar(stat = "count") + # Create the histogram (bar plot) - geom_text(aes(label = after_stat(count)), stat = "count", vjust = -0.25) + # Add labels above the bars + geom_bar(stat = "count", fill = my_colors["primary"], color = "black") + # Use primary color + geom_text(aes(label = after_stat(count)), stat = "count", vjust = -0.25, size = 5, color = my_colors["accent"]) + # Use accent color for text xlab("Day of the Week") + ylab("Number of Submissions") + - theme(axis.text.x = element_text(angle = 45, hjust = 1)) # Angle labels for better readability + ggtitle("Submissions by Day of the Week") + # Add title + theme_minimal() + # Use a cleaner theme + theme(axis.text.x = element_text(angle = 45, hjust = 1, size = 12), # Adjust text size for better readability + plot.title = element_text(size = 16, hjust = 0.5)) # Center title and adjust size + ``` ```{r func-plot_submission_trends, echo=TRUE}