if there's a way to plot this using ggplot2 or similar it would save my day. I have likert scale data about employee benefits. One question will ask about how important is the benefit and the next will ask how satisfied the employee is with the benefit.
dat <- structure(list(`Medical Insurance` = structure(c(3L, 3L, 3L,
3L, 3L, 3L, 3L, 3L, 3L, 3L), .Label = c("Neutral / Undecided",
"Not at all Important", "Very Important"), class = "factor"),
`Medical: Overall` = structure(c(3L, 3L, 4L, 4L, 4L, 3L,
4L, 4L, 3L, 3L), .Label = c("Don't Use", "Less Satisfied",
"Satisfied", "Very Satisfied"), class = "factor"), `Wellness Program` = structure(c(3L,
3L, 1L, 3L, 3L, 1L, 3L, 3L, 3L, 1L), .Label = c("Neutral / Undecided",
"Not at all Important", "Very Important"), class = "factor"),
`Medical: Wellness Program` = structure(c(3L, 3L, 4L, 4L,
4L, 3L, 3L, 4L, 3L, 1L), .Label = c("Don't Use", "Less Satisfied",
"Satisfied", "Very Satisfied"), class = "factor"), `Employee Assistance Program` = structure(c(1L,
3L, 1L, 1L, 1L, 1L, 1L, 3L, 1L, 1L), .Label = c("Neutral / Undecided",
"Not at all Important", "Very Important"), class = "factor"),
`Employee Assistance Program2` = structure(c(1L, 4L, 3L,
1L, 4L, 1L, 3L, 4L, 2L, 1L), .Label = c("Don't Use", "Less Satisfied",
"Satisfied", "Very Satisfied"), class = "factor")), row.names = c(NA,
10L), class = "data.frame")
And I can plot each of the scales separately:
ben.imp <- dat[,seq(1,5,2)]
ben.sat <- dat[,seq(2,6,2)]
library(ggthemes)
library(stringr)
library(sjPlot)
library(sjmisc)
library(ggplot2)
library(wesanderson)
col2 <- c(wes_palettes$GrandBudapest1[2],wes_palettes$Cavalcanti1[4])
likert.ben <- plot_likert(ben.imp, cat.neutral = 1, sort.frq="neg.desc", reverse.colors=T, values = "show",
show.n=F, digits=0, show.prc.sign=T, show.legend=T, geom.colors=col2, cat.neutral.color=col1[1])+
theme(
legend.title=element_text(size=14),
axis.text=element_text(size=12, face="bold"),
legend.text=element_text(size=12),
panel.background = element_rect(fill = "transparent",colour = NA),
plot.background = element_rect(fill = "transparent",colour = NA),
#panel.border=element_blank(),
panel.grid.major=element_blank(),
panel.grid.minor=element_blank()
)+
guides(fill = guide_legend(reverse=TRUE))+
geom_text(size=5, position = position_dodge2(width=0.9), vjust=0)
col4 <- c("gray", wes_palettes$GrandBudapest1[2],wes_palettes$Darjeeling2[4], wes_palettes$Cavalcanti1[4])
likert.bensat <- plot_likert(ben.sat, catcount=4, sort.frq="neg.desc",
reverse.colors=T, values = "show",
show.n=F, digits=0, show.prc.sign=T, show.legend=T, geom.colors=col4, cat.neutral.color=col1[1])+
theme(
legend.title=element_text(size=14),
axis.text=element_text(size=12, face="bold"),
legend.text=element_text(size=12),
panel.background = element_rect(fill = "transparent",colour = NA),
plot.background = element_rect(fill = "transparent",colour = NA),
#panel.border=element_blank(),
panel.grid.major=element_blank(),
panel.grid.minor=element_blank()
)+
guides(fill = guide_legend(reverse=TRUE))+
geom_text(size=5, position = position_dodge2(width=0.9), vjust=0)
But I would like to see a plot like this:
How easy would that be? Or do I need to just do it in photoshop? :/
I don't know if you can do this with
plot_likert
, but you can do it natively withggplot
. You need to reshape your data a bit first though: