Hi Luis,

You can avoid the pixelation by exporting your plot as vector graphics
(e.g. functions pdf() or svg()) instead of pixel formats (i.e. png(),
tiff() etc). There is also ggsave("MyPlot.pdf") but I don't know about
ggplot very well.

pdf("MyPlot.pdf")
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"))
dev.off()

On Thu, Jun 3, 2021 at 10:10 AM Luis Fernando García <luysgar...@gmail.com>
wrote:

>   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]]
>
> _______________________________________________
> R-sig-ecology mailing list
> R-sig-ecology@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
>

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-ecology mailing list
R-sig-ecology@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology

Reply via email to