search for: plotdata2

Displaying 3 results from an estimated 3 matches for "plotdata2".

Did you mean: plotdata
2008 Mar 25
2
ggplot2 - facetting
...g, but here also I can not find how to do this. I do not want to use qplot, but rather the more flexible options. However, it seems I am doing still something pretty stupid, because I always get an error, even if it seems I am doing everything like 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...
2008 Mar 23
2
ggplot2 - legend for fill coulours
...ll colours. When the sequence is different, the legend gets "scrambled", in that the order of the colours does not match the labels. My code is below. Can anyone tell me how to get around this? (R 2.2.6 for Windows, ggplot2 version 2_0.5.7) Thanks, Pedro library(ggplot2) Data: > plotdata2 x y group 1 1 0.1 grey30 2 2 0.2 grey30 3 3 0.3 grey10 4 4 0.4 grey90 5 1 0.1 grey30 6 2 0.2 grey60 7 3 0.3 grey60 8 4 0.4 grey90 9 1 0.1 grey60 10 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$gro...
2000 Jul 07
2
Question of programming style
...: mmtop94.2[lower.tri(mmtop94.2)] <- NA # Here i is the row (y variable), j is the column (x var) plotdata <- matrix(0, ncol=3, nrow=121) for (i in 1:11) { for (j in 1:11) { k <- (i-1) * 11 + j plotdata[k,] <- c(j, abs(i - 12), mmtop94.2[i, j]) } } plotdata2 <- na.omit(plotdata) scatterplot3d(plotdata2, type='h') It seems to me that I should not have to initialize the plotdata matrix. And are all those for loops really necessary? Thanks in advance for the help. ______________________________________________________________________ Stuart...