1

Is it possible to have different legend position in the same plot Currently, I am using

theme(legend.position="bottom")

But I have two legends and would like to move one to the right and the other remain in the bottom.

library(ggplot2)

p1 <- ggplot(grs, aes(x=grs$Pheno, y=grs$Type, weight=logp, colour=grs$Beta,size=logp))+
      geom_point(shape=15)+
geom_text(data=grs,size=4,color="black",mapping=aes(x=Pheno,y=Type,label=ifelse(logp>1.3,"x",'')))+
      scale_size_continuous(range=c(2,18),limits = c(0,25),breaks = c(1.3,seq(2,max(grs$logp),by = 2)))+
      scale_colour_gradientn(name="Beta",limits=c(-0.5, 0.5),colours = topo.colors(4))+
      scale_y_discrete("GRS")+
      theme(
        panel.background = element_rect(fill = "#696868", color = "orange", size = 2)
      )+
      theme(panel.grid.major = element_line(colour = "black",linetype = "dotted"))+
      theme(axis.text=bold.12.text)+
      theme(axis.text.x=element_blank(),axis.ticks.x=element_blank())+
      theme(axis.title.x=element_blank())+
      theme(legend.position="bottom")
Hack-R
  • 22,422
  • 14
  • 75
  • 131
MrMsarguru
  • 125
  • 1
  • 1
  • 10
  • 1
    You forgot to include the object `grs` to meet the reproducible example requirement – Hack-R Aug 19 '16 at 03:43
  • 1
    Some option here: [how-do-i-position-two-legends-independently-in-ggplot](http://stackoverflow.com/questions/13143894/how-do-i-position-two-legends-independently-in-ggplot/13327793#13327793) – Sandy Muspratt Aug 19 '16 at 07:26

0 Answers0