Problems with split captions in ggplot2

Asked

Viewed 45 times

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").

Figura 1

Figure 1

Figura 2

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") 
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.