r - ggplot gives "arguments imply differing number of rows" error in geom_point while it isn't true - how to debug? -
r - ggplot gives "arguments imply differing number of rows" error in geom_point while it isn't true - how to debug? -
i have 2 objects of type large spatialpointsdataframe named st2 , st10. come same source. both plot without problems with:
plot(st2) or
plot(st10) but want plot them ggmap , ggplot. can st2 simple code this:
map <- get_map(location = 'poznaĆ', zoom = 12) ggmap(map) + geom_point(aes(x =st2@coords[,1], y = st2@coords[,2])) but when comes st10 error:
error in data.frame(x = c(16.910848618, 16.910863876, 16.910913467, 16.910936356, : arguments imply differing number of rows: 53885, 4 i check values length():
> length(st10@coords[,1]) [1] 53885 > length(st10@coords[,2]) [1] 53885 i check them summary()
> summary(st10@coords[,1]) min. 1st qu. median mean 3rd qu. max. 16.84 16.88 16.91 16.91 16.91 16.99 > summary(st10@coords[,2]) min. 1st qu. median mean 3rd qu. max. 52.35 52.41 52.46 52.44 52.46 52.46 what wrong? have on 20 of sp info frames , of plot other give error mentioned above...this not related number of points
what can wrong? or maybe can give me tips how can debug this?
i got around making new info frame.
tldata=data.frame(x=c(0,100000),y=c(0,1000000) ggplot(otherdf,aes(x=x,y=y)+geom_point(alpha=0.1)+geom_line(data=tldata,aes(x=x,y=y),color='red') it seems ggplot no longer likes have data-less geom components, prior version used okay using aes(x=c(0,100000),y=c(0,100000).
r spatial ggplot2
Comments
Post a Comment