plotting likert scale values setting either side of xaxis 0 to be positive in ggplot

40 views Asked by At

I'm building my own likert scale graphing tool, I have

plt_data <- structure(list(gender = c("Female", "Female", "Female", "Female", 
"Male", "Male", "Male", "Male"), ST268Q04JA = structure(c(1L, 
2L, 3L, 4L, 1L, 2L, 3L, 4L), levels = c("Strongly disagree", 
"Disagree", "Agree", "Strongly agree"), class = "factor"), total = c(-23.7057728119181, 
-38.3985102420857, 31.340782122905, 6.55493482309125, -12.3867069486405, 
-32.4206948640483, 42.4660120845921, 12.726586102719), plot_group = structure(c(1L, 
2L, 4L, 3L, 1L, 2L, 4L, 3L), levels = c("Strongly disagree", 
"Disagree", "Strongly agree", "Agree"), class = "factor")), row.names = c(NA, 
-8L), class = c("tbl_df", "tbl", "data.frame"))

ggplot(plt_data,
         aes(x = gender, y = total, 
             fill= ST268Q04JA)) +
    geom_col(colour="white") +
coord_flip() +
theme(legend.position = "bottom")

This produces a good looking chart, but the x-axis runs from negative 60 to positive 60:

enter image description here

When I need it to run from +60 through 0 to +60. I've tried

scale_y_continuous(c(seq(60, 0, -10), seq(10, 60, 10)))

But it's not having any effect.

0

There are 0 answers