library(gcookbook) # For the data set
csub <- subset(climate, Source=="Berkeley" & Year >= 1900)
csub$pos <- csub$Anomaly10y >= 0
ggplot(csub, aes(x=Year, y=Anomaly10y, fill=pos)) +
geom_bar(stat="identity", position="identity")

library(gcookbook) # For the data set
csub <- subset(climate, Source=="Berkeley" & Year >= 1900)
ggplot(csub, aes(x=Year, y=Anomaly10y, fill=pos)) +
geom_bar(stat="identity", position="identity", colour="black", size=0.25) +
scale_fill_manual(values=c("#CCEEFF", "#FFDDDD"), guide=FALSE)

颜色改成蓝色,颜色值也跟着改
library(gcookbook) # For the data set
csub <- subset(climate, Source=="Berkeley" & Year >= 1900)
csub$pos <- csub$Anomaly10y >= 0
ggplot(csub, aes(x=Year, y=Anomaly10y, fill=pos)) +
geom_bar(stat="identity", position="dodge")
ggplot(csub, aes(x=Year, y=Anomaly10y, fill=pos)) +
geom_bar(stat="identity", position="identity", colour="blue", size=0.25) +
scale_fill_manual(values=c("#CCEFFF", "#FFDDAD"), guide=FALSE)

library(gcookbook) # For the data set
csub <- subset(climate, Source=="Berkeley" & Year >= 1900)
csub$pos <- csub$Anomaly10y >= 0
ggplot(csub, aes(x=Year, y=Anomaly10y, fill=pos)) +
geom_bar(stat="identity", position="dodge")
ggplot(csub, aes(x=Year, y=Anomaly10y, fill=pos)) +
geom_bar(stat="identity", position="identity", colour="cyan", size=0.25) +
scale_fill_manual(values=c("#CCEFFF", "#FFDDAD"), guide=FALSE)

ggplot(csub, aes(x=Year, y=Anomaly10y, fill=pos)) +
geom_bar(stat="identity", position="identity", colour="brown", size=0.25) +
scale_fill_manual(values=c("#CCEFFF", "#FFDDAD"), guide=FALSE)

ggplot(csub, aes(x=Year, y=Anomaly10y, fill=pos)) +
geom_bar(stat="identity", position="identity", colour="pink", size=0.25) +
scale_fill_manual(values=c( "purple4", "red4"), guide=FALSE)

ggplot(csub, aes(x=Year, y=Anomaly10y, fill=pos)) +
geom_bar(stat="identity", position="identity", colour="white", size=0.25) +
scale_fill_manual(values=c( "cyan4", "black"), guide=FALSE)

参考文献:R数据科学—[新西兰]哈德利 威克姆,[美]加勒特 格罗勒芒德—陈光欣[译] 北京:人民邮电出版社
百度文库—颜色大全:含中英文对照及色值