Displaying 2 results from an estimated 2 matches for "powermap".
Did you mean:
powermac
2011 Apr 22
1
ggplot
...ng ggplot
to plot but I am getting the following error which I do not understand
Error: geom_text requires the following missing aesthetics: label
My code is
dimx<-256
library(ggplot2)
dev.new()
xandy<-expand.grid(seq(1:dimx),seq(1:dimy))
xx<-data.frame(xandy[[1]],xandy[[2]],Powermap=Powermap)
subsetxx<-subset(xx, xx$Powermap>threshold)
ggplot( (subsetxx ) )+
geom_point(aes(x,y,colour=cut(Powermap,c(0,-1,-10,-20,-30,-40,-50,-60,-70,-80,-90,-100,-110))))+
geom_text(aes(x,y,color=cut(Powermap, c(0,-1,-10,-20,-30,-40,-50,-60,-70,-80,-90,-100,-110)), label=round(Po...
2011 Apr 27
6
Assignments inside lapply
Dear all I would like to ask you if an assignment can be done inside a lapply statement.
For example
I would like to covert a double nested for loop
for (i in c(1:dimx)){
for (j in c(1:dimy)){
Powermap[i,j] <- Pr(c(i,j),c(PRX,PRY),f)
}
}
to something like that:
ij<-expand.grid(i=seq(1:dimx),j=(1:dimy))
unlist(lapply(1:nrow(ij),function(rowId) { return (Powermap[i,j]<-Pr(c(ij$i[rowId],ij$j[rowId]),c(PRX,PRY),f)) }))
as you can see lapply does not return nothing as the assignmen...