Reputation: 161
I am trying to use the plot_model()
function (sjPlot
package) in R. However, it only allow me to use the minimum range of x-axis as -1 to 1. Since my estimates are very small, I would like to change the range to -0.2 to 0.2. I have tried this code:
sjPlot::plot_model(lm_PMd2,
axis.labels=c("TimeInterval",
"FactorAnalyses_diff"),
show.values=TRUE, show.p=TRUE,
colors = "#ec7014",
title="PMd", axis.lim = c(-0.2, 0.2)) +
theme_bw()+
theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
text = element_text(size = 12))
Any insight is helpful. Thanks!
Upvotes: 0
Views: 1002
Reputation: 226637
I think you can do this (no reproducible example given, so I made one up):
m1 <- lm(Murder ~ UrbanPop, data = USArrests)
library(sjPlot)
plot_model(m1) + scale_y_continuous(limits = c(-0.2, 0.2))
coord_flip()
specification.axis.lim = c(-0.2, 0.2)
doesn't do what you want — perhaps it's either a bug or confusingly documented?Numeric vector of length 2, defining the range of the plot axis. Depending on plot-type, may effect [sic] either x- or y-axis. For Marginal Effects plots, ‘axis.lim’ may also be a list of two vectors of length 2, defining axis limits for both the x and y axis.
Upvotes: 0