Modify histogram
This commit is contained in:
parent
1bda12695d
commit
5c7b7e37b0
18
report.Rmd
18
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.
|
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}
|
```{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(dplyr)
|
||||||
library(ggplot2)
|
library(ggplot2)
|
||||||
|
|
||||||
@ -115,11 +123,15 @@ survey_data %>%
|
|||||||
mutate(DayOfWeek = factor(weekdays(CreationDate),
|
mutate(DayOfWeek = factor(weekdays(CreationDate),
|
||||||
levels = c("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"))) %>% # Set order of days
|
levels = c("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"))) %>% # Set order of days
|
||||||
ggplot(aes(x = DayOfWeek)) +
|
ggplot(aes(x = DayOfWeek)) +
|
||||||
geom_bar(stat = "count") + # Create the histogram (bar plot)
|
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) + # Add labels above the bars
|
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") +
|
xlab("Day of the Week") +
|
||||||
ylab("Number of Submissions") +
|
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}
|
```{r func-plot_submission_trends, echo=TRUE}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user