我正在遵循书中的一个例子Machine Learning for Hackers
. R 2.15.1
和 ggplot 0.91
使用。我收到以下错误:
Error in continuous_scale(aesthetics, "date", identity, breaks = breaks, :
unused argument(s) (major = "5 years", format = "%Y")
In addition: Warning message:
In discrete_scale(aesthetic, "manual", pal, ...) :
"legend" argument in scale_XXX is deprecated. Use guide="none" for suppress the guide display.
我尝试运行的代码是
state.plot<-ggplot(all.sightings, aes(x=YearMonth,y=Sightings))+
geom_line(aes(color="darkblue"))+
facet_wrap(~State,nrow=10,ncol=5)+
theme_bw()+
scale_color_manual(values=c("darkblue"="darkblue"),legend=FALSE)+
scale_x_date(major="5 years", format="%Y")+
xlab("Time")+ylab("Number of Sightings")+
opts(title="Number of UFO sightings by Month-Year and U.S. State (1990-2010)")
我用过
library(scales)
但这没有用。有什么想法吗?
最佳答案
试试这个
state.plot<-ggplot(all.sightings, aes(x=YearMonth,y=Sightings))+
geom_line(aes(color="darkblue"))+
facet_wrap(~State,nrow=10,ncol=5)+
theme_bw()+
scale_color_manual(values=c("darkblue"="darkblue"),guide=FALSE)+
scale_x_date(breaks = date_breaks("5 years"), labels = date_format("%Y"))+
xlab("Time")+ylab("Number of Sightings")+
opts(title="Number of UFO sightings by Month-Year and U.S. State (1990-2010)")
关于r - 使用 R 和 ggplot2 时连续缩放的错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12189069/