Using likert.density.plot from library("likert"), I am attempting to make a density plot of likert data. The plot works, but I can't seem to change all the aspects of visualization I am expecting to. Particularly I would like to change:
Fill transparency to opaque - pretty sure the argument to pass to density is alpha=1, but I can't figure out where it goes
Removing the vertical lines at the means. Attempted to use geom_vline(FALSE) but didn't work.
Minimal Working Example:
(Actual data cannot be disclosed, so generated some in the same format)
df = data.frame(Q1Pre=c(1,2,1,2,1,3,2,1),Q1Post=c(2,1,3,2,3,2,3,2))
# Covert values to factors
df = lapply(df, factor, levels = 1:3)
df = as.data.frame(df)
#Convert to likert object
likertdf = likert(df)
likert.density.plot(likertdf, facet=FALSE, bw=0.5)
I would like this to look more like this (with opaque color and no mean line):
Which can be done with ggplot as + geom_density()
, so tried
likert.density.plot(likertdf,facet=FALSE,bw=0.5,aes(geom_density))
with no change.
Here is a slightly larger than working example to show how I have done some of the other formatting:
likert.density.plot(likertdf,facet=FALSE,bw=0.5) +
scale_x_continuous(breaks=c(1,2,3),
labels=c("Disagree", "Neutral", "Agree")) +
scale_fill_manual(values = c("red","blue"))
Which does change the colors and axes as desired:
But the same types of formatting edits don't change the fill or remove the mean line.