程序出现问题,前面没有问题,最后一步说有问题,然后就懵了。。。。问题如下:
> pdf("f:/1 800.pdf",width=5,height=4)
> print(p)
错误: Aesthetics must be either length 1 or the same as the data (1656324): x, y
> dev.off()
null device
1
p <- ggplot(traj,aes(x=traj$lon,y=traj$lat))
p <- p + facet_grid(date~night)
p <- p + geom_polygon(data=outline,aes(x=outline$long,y=outline$lat),colour="grey",linetype=1,size=0.2,fill="white")
p <- p + stat_density2d(aes(alpha = ..level..),size = 0.01, bins = 16, geom = 'polygon')
p <- p + scale_x_continuous(limits=c(x1,x2),expand = c(0,0))
p <- p + scale_y_continuous(limits=c(y1,y2),expand = c(0,0))
#p <- p + theme(legend.position='none')
p <- p + theme(text=element_text(color='black', size=10))
p <- p + coord_equal()