3
Hello, I’d like your help on subtitles using the ggplot2
. I want to extract a caption to use in another graphic that uses plot_grid
, but I don’t know why, but the same code works (Figure 1) and stops working (Figure 2), and sometimes even using the +theme()
divides subtitles (Figure 2). To +theme()
I use: theme(text = element_text(family="Times New Roman",size=rel(4)),legend.text = element_text(family="Times New Roman",size=18),legend.position = "bottom")
.
Figure 1
Figure 2
follows the code:
expres<-expression(italic(hat(Y)) == -1.314 * x^"***" ~ ~~italic(R)^{2} == 0.96)
legenda<-expand.grid(Y=rev(seq(-1.0,-.2,.2)),x=rev(seq(-1.0,-.2,.2)),tipo=1:2)
ggplot(legenda,aes(x=Y,y=x))+
geom_line(aes(linetype=as.factor(tipo),colour=as.factor(tipo)),size=1)+
scale_linetype_manual(name="Tipo:",labels=c(eval(parse(text=paste('expression(',expres,')',sep=""))),"reta 1:1"),values=c(1,2),breaks=c(1,2))+
scale_color_manual(name="Tipo:",labels=c(eval(parse(text=paste('expression(',expres,')',sep=""))),"reta 1:1"),values=c("black","blue"),breaks = c(1,2))+
theme(legend.position = "bottom")