[R] Question about sjPlot lines and scale
Luis Fernando García
|uy@g@rc|@ @end|ng |rom gm@||@com
Wed Jun 2 09:46:32 CEST 2021
Dear all,
I am wanting to improve a plot made with the package sjPlot.
When plotting this model
Plot produced looks like this
https://docs.google.com/presentation/d/1Pqm6BcJXdSQ6U1zmv5FV7gBcn1afHHv7rlQHe6j59_c/edit?usp=sharing,
especially red and green lines.
I just have two concerns with this, the first one is that lines seem a bit
pixelated, and I would like to improve it, I have tried some approaches but
it has not been possible.
Dataset in this link:
https://docs.google.com/spreadsheets/d/1nXerN91Iehe9OM1VGDMS3jnbvvF1tWcuS9bGtlrj_Ss/edit?usp=sharing
library(geepack)
library(ggplot2)
library(sjPlot)
library(ggeffects)
#Copy dataset before following the code
dat <- read.delim("clipboard", dec=","); attach(dat)
dat$Id <- as.integer(factor(dat$Esp))
str(dat)
m5 <- geeglm(
formula = tim ~ Pa*Pt,
family = Gamma(link = log),
data = dat,
id = Id,
corstr = "exchangeable"
)
anova(m5,test="chisq")
p= plot_model(m5, type = "pred", terms = c("Pt[n=100]", "Pa"),
digits=1,line.size=0.5,show.data=T,colors=c("green","#00a0c9","red"))
p
The second one, is I would like to remove the decimal values (i.e. in the x
axis), however I´m not very sure if it is possible to do this in sjPlot or
if you know a similar alternative in ggplot2. I tried this approach but it
did not work.
p=p+ scale_x_discrete(limits=c(1,2,3))
p
When making this plot, there is a space before 1 and after 3 I would like
to erase.
Best
[[alternative HTML version deleted]]
More information about the R-help
mailing list