0

I am trying to manually add labels to my legend using sjPlot in R. Currently, the legend is showing the numerical value of each category (1-7), but I would like the legend labels to read Strong Democrat, Democrat, Lean Democrat, Independent, Lean Republican, Republican, and Strong Republican.

Here is my current code, which correctly generates the graph I want and the legend title, but still shows 1-7 where my legend labels should be. I am not getting any error codes.

Model1A <- lm(NPFrqw2 ~ Agew1 + Gendw1 + Racew1 + Eduw1 + PolIntw1 + PKw1 +
            LibFrqw1 + ConFrqw1 + NPFrqw1 + Partyw1*FDw1,
          data = dataplustwosyntaxfiles)

plot_model(Model1A, type = "pred", terms = c("FDw1", "Partyw1"),
       title = "",
       legend.title = "Political Party Affliation",
       legend.labels = c("Strong Democrat", "Democrat", "Lean Democrat",
                         "Independent", "Lean Republican", "Republican",
                         "Strong Republican"),
       colors = "gs",
       axis.title=c("Feeling Disinformed", "Non-Partisan News Use"))

enter image description here

Is there something wrong with my code? From what I understand the legend.labels argument should work. Alternatively, is there another way I can change my legend labels?

jrcalabrese
  • 2,184
  • 3
  • 10
  • 30

0 Answers0