1

I have a problem with changing the x axis in plot_models function.

I have a number of linear regression models for which I want to plot the estimates. I'm using plot_models from sjPlot function but I've encountered a problem with the x axis. It is from -1 to 1. All of my estimates are rather small (ranging from -.2 to .2). I would love to change the x axis limits to -.5:.5. However, I can't find a way to do that. Scale_x_continuous() does not seem to work. I just get the error:

Scale for 'x' is already present. Adding another scale for 'x', which will replace theexisting scale. ERROR: Discrete value supplied to continuous scale."

I thought axis.lim argument would do that but it does not change anything in the plot. Using only scale_x_continuous() or axis.lim does not work either. Below is the code I used:

plot_models(WILPHQ2, WILPTSD2, WILPANAS2, WILSWLS2, WILROS2, grid = T, show.p = T, 
            show.values = T, axis.lim = c(-.5:.5), dot.size = 2,
            vline.color = "black") + theme_bw()

And the plot I have so far: The plot so far

Sorry if this is a silly question or it's all a bit messy, it's my first question on stack overflow!

Honestiore
  • 53
  • 3

0 Answers0