关于属性设置什么时候放在aes()里面的问题
我在看R graphics cookbook的一个例子
library(gcookbook)
csub <- subset(climate, Source=="Berkeley" & Year >=1900)
csub$pos <- csub$Anomaly10y >=0
这个是没有问题的:
ggplot(csub,aes(x=Year,y=Anomaly10y))+
geom_bar(stat="identity",position="identity",aes(fill=pos))
这个不行:
ggplot(csub,aes(x=Year,y=Anomaly10y))+
geom_bar(stat="identity",position="identity",fill=pos)
这个可以:
ggplot(csub,aes(x=Year,y=Anomaly10y,fill=pos))+
geom_bar(stat="identity",position="identity",colour="black")
这个不行
ggplot(csub,aes(x=Year,y=Anomaly10y,fill=pos,colour=I("black")))+
geom_bar(stat="identity",position="identity")