2

Q1: the plot_models function. yes, dot size can be settled, but the value size and position are not working. value.size= is not working here. how to fix it? Q2: see the figure below, the color of dots is automatically set, is there any way I could change the dot color since the yellow color is so bad for readers.

here's the syntax:

plot_models(myfit01, myfit03, myfit04, myfit05, myfit14, myfit19, myfit22,
transform="exp", legend.title = "Topics",axis.lim = c(0.1, 8), 
axis.labels = c("NBV", "BAS"),
m.labels = c("T01", "T03", "T04","T05", "T14", "T19","T22"),show.values = T, 
show.p = T, p.shape = TRUE, digits=4, 
p.threshold = c(0.05, 0.01, 0.001), 
vline.color = "#edd840",dot.size = 3, spacing=0.7, ci.lvl=0.95, grid=F)+
theme_bw()+theme( legend.title = element_text(color = "blue", size = 14),
legend.text = element_text(size = 12),axis.title.x = element_text(size = 14), 
axis.text.x = element_text(size=14), axis.text.y = element_text(size=16))+
ggtitle("szc")+
theme(plot.title = element_text(family="Georgia", colour="black", size=14))

by sjPlot

StupidWolf
  • 45,075
  • 17
  • 40
  • 72
George Nee
  • 21
  • 3

1 Answers1

0

You change the colour using the "col=" option and by size, i guess you are referring to the size of the text, there is no option for that, you need to change the default for geom_text unfortunately.. see below:

Some example data:

library(ggplot2)
library(sjPlot)

data(efc)
fit1 <- lm(barthtot ~ c160age + c12hour + c161sex + c172code, data = efc)
fit2 <- lm(neg_c_7 ~ c160age + c12hour + c161sex + c172code, data = efc)
fit3 <- lm(tot_sc_e ~ c160age + c12hour + c161sex + c172code, data = efc)

Then:

GeomText$default_aes$size
[1] 3.88

This is the default size for the text, you go down to decrease the size. This is how the plot looks like at first:

plot_models(fit1,fit2,fit3, 
axis.labels = c("Carer's Age", "Hours of Care"),
m.labels = c("Barthel Index", "Negative Impact", "Services used"),
show.values = TRUE, show.p = TRUE,
p.shape = TRUE, digits=4, 
p.threshold = c(0.05, 0.01, 0.001), 
vline.color = "#edd840",dot.size = 3, spacing=0.7, ci.lvl=0.95, grid=F,
colors = c("orange","salmon","cadetblue"))

enter image description here

Now we change them:

GeomText$default_aes$size <- 2.5
plot_models(fit1,fit2,fit3, 
axis.labels = c("Carer's Age", "Hours of Care"),
m.labels = c("Barthel Index", "Negative Impact", "Services used"),
show.values = TRUE, show.p = TRUE,
p.shape = TRUE, digits=4, 
p.threshold = c(0.05, 0.01, 0.001), 
vline.color = "#edd840",dot.size = 3, spacing=0.7, ci.lvl=0.95, grid=F,
colors = "social")

enter image description here

There's a series of color palettes you can choose from:

show_sjplot_pals()

Or you can specify your own colors like:

colors = c("grey","orange","red")
StupidWolf
  • 45,075
  • 17
  • 40
  • 72