The following analysis provides a breakdown of attitudes towards pro-Palestine protests across different racial groups. The data, sourced from a Suffolk University/USA TODAY survey conducted in May 2024, offers insight into the varied perspectives held by White, Black, and Hispanic populations. This examination aims to highlight the differences in support, opposition, and neutrality regarding the protests.

Data Preparation

In this section, we prepare the data for visualization. We categorize the survey responses into five distinct attitudes: ‘Refused’, ‘Undecided’, ‘Oppose’, ‘Agree, Oppose Method’, and ‘Support’.

# Define the racial categories, attitudes, and corresponding percentages
races <- c('White', 'Black', 'Hispanic')
attitudes <- c('Refused', 'Undecided', 'Oppose', 'Agree, Oppose Method', 'Support')
percentages <- matrix(c(
  2, 9, 52, 21, 15,  # Percentages for White
  2, 12, 19, 38, 29, # Percentages for Black
  0, 12, 33, 30, 25  # Percentages for Hispanic
), nrow = length(races), byrow = TRUE)

# Convert the matrix to a data frame
values <- as.data.frame(percentages)
colnames(values) <- attitudes
values$Race <- races

# Reshape the data frame to long format
values_long <- reshape2::melt(values, id.vars = "Race", variable.name = "Attitude", value.name = "Percentage")

# Convert Attitude to a factor with specified levels
values_long$Attitude <- factor(values_long$Attitude, levels = attitudes)

Visualization

In this section, we present a stacked bar chart that visually represents the distribution of attitudes towards pro-Palestine protests among the three racial groups. Each bar is segmented to show the proportion of each attitude within the group.

# Generate the stacked bar chart with contours
ggplot(values_long, aes(fill=Attitude, y=Percentage, x=Race)) + 
  geom_bar(stat="identity", position="stack", width=0.5, color="black", size=0.1) +  # Add black contours with thin lines
  geom_text(aes(label=ifelse(Percentage > 0, paste0(Percentage, "%"), "0%")), 
            position=position_stack(vjust=0.5), size=3, color="black") +
  scale_fill_manual(values=c('white', 'grey', 'tomato', 'lightgreen', 'darkgreen')) +
  theme_minimal() +
  labs(x='Racial Group', y='Percentage (%)', title='Racial Breakdown of Attitudes Towards Pro-Palestine Protests', 
       caption='Suffolk University/USA TODAY, May 2024 | Visualization : M.D.Hammami') +
  theme(legend.title = element_text(size=12, face="bold"),
        legend.text = element_text(size=10),
        legend.position = "bottom",
        legend.box = "horizontal",
        legend.spacing.x = unit(0.2, 'cm'),
        legend.key = element_rect(color="black", size=0.2)) +
  guides(fill=guide_legend(nrow=1, byrow=TRUE))
## Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
## ℹ Please use `linewidth` instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
## Warning: The `size` argument of `element_rect()` is deprecated as of ggplot2 3.4.0.
## ℹ Please use the `linewidth` argument instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.