Displaying 3 results from an estimated 3 matches for "plot0".
Did you mean:
plot
2008 Mar 25
2
ggplot2 - facetting
...ike the examples.
My code is below.
set.seed(123)
plotdata2<-data.frame(x=rep((1:4),4), y=rep(0.1*(1:4),4),
group=sample(factor(rep(1:4,rep(4,4)), labels=c('Class1', 'Class2',
'Class3', 'Class4'))))
plotdata2 <- plotdata2[order(plotdata2[,'group']),]
plot0<-ggplot()
layer1<-layer(data=plotdata2,
mapping=aes_string(x='x',y='y'),geom='point', stat='identity')
scaleY<-scale_y_continuous()
scaleX <- scale_x_continuous()
Facets<-facet_grid(group ~ .)
plot1<-plot0+layer1 +scaleY + scaleX + facet_grid(group...
2007 Dec 17
1
ggplot-How to define fill colours?
...ine. Any hints
about how to get this?
Thanks in advance,
Pedro
============================================
my code:
>plotdata1<-data.frame(x=rep(factor(1:4),4), y=rep(0.1*(1:4),4),
+group=as.character(rep(c('white', 'red', 'blue', 'green'),rep(4,4))))
>plot0<-ggplot()
>plot3<-plot0+layer(data=plotdata1, mapping=aes_string(x='x',y='y',
+fill='group'),geom='bar', stat='identity', position='stack')
>print(plot3)
2008 Mar 23
2
ggplot2 - legend for fill coulours
...0 2 0.2 grey10
11 3 0.3 grey90
12 4 0.4 grey30
13 1 0.1 grey90
14 2 0.2 grey60
15 3 0.3 grey10
16 4 0.4 grey10
> levels(plotdata2$group)
[1] "grey10" "grey30" "grey60" "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')...