I made this plot:
#data
sal<-data.frame(x=factor(c(2,2,1,1),labels=c('House','Work')))
sal$id<-factor(c(2,1,2,1),labels=c('t0','t1'))
sal$val<-c(305,280,290,180)
sal$lim1<-c(75,75,150,150)
sal$lim2<-c(150,150,300,300)
#plot
p<-ggplot(sal,aes(id,y=val,fill=id))+
geom_bar(stat="identity",position="dodge",width=.75)+
scale_fill_brewer(palette='Set1',type='qual',name='Time')+
theme(axis.title.x=element_blank(),
axis.title.y=element_blank(),
panel.background=element_rect(fill="transparent",colour=NA),
panel.grid.minor=element_line(colour='grey',linetype=2),
panel.grid.major=element_line(colour='grey'),
plot.background=element_rect(fill="transparent",colour=NA),
axis.ticks=element_blank(),
axis.text.x=element_blank(),
legend.position='bottom')+
geom_hline(aes(yintercept=lim1,lty='lim1'),lwd=1,show_guide=T)+
geom_hline(aes(yintercept=lim2,lty='lim2'),lwd=1,show.guide=T)+
scale_linetype_manual(name="Recommendations",values=1:2,
labels=c('R1','R2'))
p+facet_grid(.~x)+theme(strip.background=element_rect(colour='white',fill='transparent'),
strip.text.x=element_text(size=15,face='bold'))
I need to erase the line in the Time
legend which appears inside the colors. And at the same time I want a transparent background in the Recommendations
legend.