Displaying 1 result from an estimated 1 matches for "scalefill".
2008 Mar 23
2
ggplot2 - legend for fill coulours
...0" "grey90"
> as.numeric(plotdata2$group)
[1] 2 2 1 4 2 3 3 4 3 1 4 2 4 3 1 1
Code:
plot0<-ggplot()
layer1<-layer(data=plotdata2, mapping=aes_string(x='x',y='y',
fill='group'),geom='bar', stat='identity', position='stack')
scaleFill<-scale_fill_identity(labels=levels(plotdata2$group),
guide='tile', name='Group')
scaleY<-scale_y_continuous(limits=c(0,4), expand=c(0,0))
plot1<-plot0+layer1 +scaleFill +scaleY
plot1