library(ggplot2) install.packages(“ggplot2”) # Create a dataframe from svymean output q1_data <- data.frame( response = c(“Approve”, “Disapprove”, “Don’t Know”), percent = c(0.394008, 0.542368, 0.063624) )

Bar chart

ggplot(q1_data, aes(x = response, y = percent)) + geom_bar(stat = “identity”) + labs(title = “Overall Approval Ratings”, x = “Response”, y = “Proportion”) + theme_minimal() # Create dataframe from your svyby output q1_sex_data <- data.frame( sex = c(“Male”, “Female”), Approve = c(0.46, 0.33), Disapprove = c(0.48, 0.60), DontKnow = c(0.06, 0.06) )

Convert to long format

library(tidyr) install.packages(“tidyr”) q1_sex_long <- pivot_longer(q1_sex_data, cols = c(“Approve”, “Disapprove”, “DontKnow”), names_to = “response”, values_to = “percent”)

Plot

ggplot(q1_sex_long, aes(x = sex, y = percent, fill = response)) + geom_bar(stat = “identity”, position = “dodge”) + labs(title = “Approval Ratings by Gender”, x = “Gender”, y = “Proportion”, fill = “Response”) + theme_minimal() ggplot(q1_data, aes(x = ““, y = percent, fill = response)) + geom_bar(stat =”identity”, width = 1) + coord_polar(“y”) + labs(title = “Overall Approval Distribution”) + theme_void()