conditional effects plot from Bayesian model (brms) scale_linetype_manual does not work

After running a Bayesian cumulative model in brms and successfully obtaining the conditional effects plot; I’ve tuned the graph but I am unable to change the linetype of the plotted regression lines.

I can successfully change the colour of each line:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>the_plotsC <- plot(conditional_effects(mSEPbayesSEEN4cINT),ask = FALSE)
legend_title <- "early-life env"
</code>
<code>the_plotsC <- plot(conditional_effects(mSEPbayesSEEN4cINT),ask = FALSE) legend_title <- "early-life env" </code>
the_plotsC <- plot(conditional_effects(mSEPbayesSEEN4cINT),ask = FALSE)
legend_title <- "early-life env"
Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>p <- the_plotsC[[7]] +
labs(x="U003BC age (years)",y="Offspring number") +
theme_bw() +
theme(axis.line = element_line(colour = "black"),
axis.title.x = element_text(size=24),
axis.title.y = element_text(size=24, vjust=0.3),
axis.text.x=element_text(size=22,margin =margin(10,0,20,0)),
axis.text.y=element_text(size=22, margin =margin(0,10,0,20)),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
panel.border = element_blank(),
panel.background = element_blank(),
legend.title=element_text(face="bold", size=14),
legend.text=element_text(size=13),
legend.position = c(0.2, 0.9))+
scale_color_manual(legend_title,labels=c("+1SD", "Mean", "-1SD"),
values=c("gray45","gray45","gray45"))+
scale_fill_manual(legend_title,
labels=c("+1SD", "Mean", "-1SD"),
values=cbPalette)
p+geom_point(data=EFrepSENseenM, aes(x=avgAGE,y=OffspringNUM), shape=21,
position = position_jitter(width = 0.3, height = 0.06),
fill="darkgray", colour="black", size=2, inherit.aes = FALSE)
</code>
<code>p <- the_plotsC[[7]] + labs(x="U003BC age (years)",y="Offspring number") + theme_bw() + theme(axis.line = element_line(colour = "black"), axis.title.x = element_text(size=24), axis.title.y = element_text(size=24, vjust=0.3), axis.text.x=element_text(size=22,margin =margin(10,0,20,0)), axis.text.y=element_text(size=22, margin =margin(0,10,0,20)), panel.grid.major = element_blank(), panel.grid.minor = element_blank(), panel.border = element_blank(), panel.background = element_blank(), legend.title=element_text(face="bold", size=14), legend.text=element_text(size=13), legend.position = c(0.2, 0.9))+ scale_color_manual(legend_title,labels=c("+1SD", "Mean", "-1SD"), values=c("gray45","gray45","gray45"))+ scale_fill_manual(legend_title, labels=c("+1SD", "Mean", "-1SD"), values=cbPalette) p+geom_point(data=EFrepSENseenM, aes(x=avgAGE,y=OffspringNUM), shape=21, position = position_jitter(width = 0.3, height = 0.06), fill="darkgray", colour="black", size=2, inherit.aes = FALSE) </code>
p <- the_plotsC[[7]] +
    labs(x="U003BC age (years)",y="Offspring number") +
    theme_bw() +
    theme(axis.line = element_line(colour = "black"),
        axis.title.x = element_text(size=24),
        axis.title.y = element_text(size=24, vjust=0.3),
        axis.text.x=element_text(size=22,margin =margin(10,0,20,0)),
        axis.text.y=element_text(size=22, margin =margin(0,10,0,20)),
        panel.grid.major = element_blank(),
        panel.grid.minor = element_blank(),
        panel.border = element_blank(),
        panel.background = element_blank(),
        legend.title=element_text(face="bold", size=14),
        legend.text=element_text(size=13),
        legend.position = c(0.2, 0.9))+   
    scale_color_manual(legend_title,labels=c("+1SD", "Mean", "-1SD"),
                       values=c("gray45","gray45","gray45"))+
    scale_fill_manual(legend_title,
                  labels=c("+1SD", "Mean", "-1SD"),
                  values=cbPalette)
p+geom_point(data=EFrepSENseenM, aes(x=avgAGE,y=OffspringNUM), shape=21,
              position = position_jitter(width = 0.3, height = 0.06), 
             fill="darkgray", colour="black", size=2, inherit.aes = FALSE)

enter image description here

However I want to use line types rather than colours for each regression line. I’ve tried several ways with scale_linetype_manual unsuccessfully. For example, calling to a vector with the values for each level of the interaction plot:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>LINES <- c("-0.031"="solid","-0.01"="longdash","0.29"="dotted")
</code>
<code>LINES <- c("-0.031"="solid","-0.01"="longdash","0.29"="dotted") </code>
LINES <- c("-0.031"="solid","-0.01"="longdash","0.29"="dotted")

and then using:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>p <- the_plotsC[[7]] +
labs(x="U003BC age (years)",y="Offspring number") +
theme_bw() +
theme(axis.line = element_line(colour = "black"),
axis.title.x = element_text(size=24),
axis.title.y = element_text(size=24, vjust=0.3),
axis.text.x=element_text(size=22,margin =margin(10,0,20,0)),
axis.text.y=element_text(size=22, margin =margin(0,10,0,20)),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
panel.border = element_blank(),
panel.background = element_blank(),
legend.title=element_text(face="bold", size=14),
legend.text=element_text(size=13),
legend.position = c(0.2, 0.5))+
scale_linetype_manual(legend_title,labels=c("+1SD", "Mean", "-1SD"),
values=LINES)+
scale_fill_manual(legend_title,
labels=c("+1SD", "Mean", "-1SD"),
values=cbPalette)
p+geom_point(data=EFrepSENseenM, aes(x=avgAGE,y=OffspringNUM), shape=21,
position = position_jitter(width = 0.3, height = 0.06),
fill="darkgray", colour="black", size=2, inherit.aes = FALSE)
</code>
<code>p <- the_plotsC[[7]] + labs(x="U003BC age (years)",y="Offspring number") + theme_bw() + theme(axis.line = element_line(colour = "black"), axis.title.x = element_text(size=24), axis.title.y = element_text(size=24, vjust=0.3), axis.text.x=element_text(size=22,margin =margin(10,0,20,0)), axis.text.y=element_text(size=22, margin =margin(0,10,0,20)), panel.grid.major = element_blank(), panel.grid.minor = element_blank(), panel.border = element_blank(), panel.background = element_blank(), legend.title=element_text(face="bold", size=14), legend.text=element_text(size=13), legend.position = c(0.2, 0.5))+ scale_linetype_manual(legend_title,labels=c("+1SD", "Mean", "-1SD"), values=LINES)+ scale_fill_manual(legend_title, labels=c("+1SD", "Mean", "-1SD"), values=cbPalette) p+geom_point(data=EFrepSENseenM, aes(x=avgAGE,y=OffspringNUM), shape=21, position = position_jitter(width = 0.3, height = 0.06), fill="darkgray", colour="black", size=2, inherit.aes = FALSE) </code>
p <- the_plotsC[[7]] +
    labs(x="U003BC age (years)",y="Offspring number") +
    theme_bw() +
    theme(axis.line = element_line(colour = "black"),
        axis.title.x = element_text(size=24),
        axis.title.y = element_text(size=24, vjust=0.3),
        axis.text.x=element_text(size=22,margin =margin(10,0,20,0)),
        axis.text.y=element_text(size=22, margin =margin(0,10,0,20)),
        panel.grid.major = element_blank(),
        panel.grid.minor = element_blank(),
        panel.border = element_blank(),
        panel.background = element_blank(),
        legend.title=element_text(face="bold", size=14),
        legend.text=element_text(size=13),
        legend.position = c(0.2, 0.5))+   
    scale_linetype_manual(legend_title,labels=c("+1SD", "Mean", "-1SD"),
                       values=LINES)+
    scale_fill_manual(legend_title,
                  labels=c("+1SD", "Mean", "-1SD"),
                  values=cbPalette)
p+geom_point(data=EFrepSENseenM, aes(x=avgAGE,y=OffspringNUM), shape=21,
              position = position_jitter(width = 0.3, height = 0.06), 
             fill="darkgray", colour="black", size=2, inherit.aes = FALSE)

enter image description here

or:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>p <- the_plotsC[[7]] +
labs(x="U003BC age (years)",y="Offspring number") +
theme_bw() +
theme(axis.line = element_line(colour = "black"),
axis.title.x = element_text(size=24),
axis.title.y = element_text(size=24, vjust=0.3),
axis.text.x=element_text(size=22,margin =margin(10,0,20,0)),
axis.text.y=element_text(size=22, margin =margin(0,10,0,20)),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
panel.border = element_blank(),
panel.background = element_blank(),
legend.title=element_text(face="bold", size=14),
legend.text=element_text(size=13),
legend.position = c(0.2, 0.5))+
scale_linetype_manual(legend_title,labels=c("+1SD", "Mean", "-1SD"),
values=c("solid","longdash","dotted))+
scale_fill_manual(legend_title,
labels=c("+1SD", "Mean", "-1SD"),
values=cbPalette)
</code>
<code>p <- the_plotsC[[7]] + labs(x="U003BC age (years)",y="Offspring number") + theme_bw() + theme(axis.line = element_line(colour = "black"), axis.title.x = element_text(size=24), axis.title.y = element_text(size=24, vjust=0.3), axis.text.x=element_text(size=22,margin =margin(10,0,20,0)), axis.text.y=element_text(size=22, margin =margin(0,10,0,20)), panel.grid.major = element_blank(), panel.grid.minor = element_blank(), panel.border = element_blank(), panel.background = element_blank(), legend.title=element_text(face="bold", size=14), legend.text=element_text(size=13), legend.position = c(0.2, 0.5))+ scale_linetype_manual(legend_title,labels=c("+1SD", "Mean", "-1SD"), values=c("solid","longdash","dotted))+ scale_fill_manual(legend_title, labels=c("+1SD", "Mean", "-1SD"), values=cbPalette) </code>
p <- the_plotsC[[7]] +
    labs(x="U003BC age (years)",y="Offspring number") +
    theme_bw() +
    theme(axis.line = element_line(colour = "black"),
        axis.title.x = element_text(size=24),
        axis.title.y = element_text(size=24, vjust=0.3),
        axis.text.x=element_text(size=22,margin =margin(10,0,20,0)),
        axis.text.y=element_text(size=22, margin =margin(0,10,0,20)),
        panel.grid.major = element_blank(),
        panel.grid.minor = element_blank(),
        panel.border = element_blank(),
        panel.background = element_blank(),
        legend.title=element_text(face="bold", size=14),
        legend.text=element_text(size=13),
        legend.position = c(0.2, 0.5))+   
    scale_linetype_manual(legend_title,labels=c("+1SD", "Mean", "-1SD"),
                       values=c("solid","longdash","dotted))+
    scale_fill_manual(legend_title,
                  labels=c("+1SD", "Mean", "-1SD"),
                  values=cbPalette)

but none of them work…
Any help will be greatly appreciated. I realise I haven’t shared any df because the_plotsC is in fact a list.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật