I want to plot single scatter plot showing a different color for two station months rainfall. for example A station Jan rainfall value in red, Feb in yellow and B station Jan rainfall value in blue, Feb in green and so on which appears on the legend. Also, I want to include a smooth line for the both stations data that also appear on the legend like the red smooth line for A station and blue for station B. In this link, you can find the both stations CSV data: https://drive.google.com/file/d/0B3fQ9_46L-O0TjJwYmF6UThNSGs/view?usp=sharing https://drive.google.com/file/d/0B3fQ9_46L-O0ZXVYb3lzZDBZaHM/view?usp=sharing
Below is the code I tried but could not succeed.
#reading csv file of ramoili station of rautahat[Scatterplot of two stations][1]
ram = read.csv('preci_ramoili.csv',header=TRUE, stringsAsFactors=FALSE)
#reading CSV file of gaur station of rautahat
gaur= read.csv('preci_Gaur.csv',header=TRUE, stringsAsFactors=FALSE)
#gaur rainfall
rain <- data.frame(index(agg),stack(as.data.frame(coredata(agg))))
rain
head(rain)
tail(rain)
names(rain)[1] <- "Year"
names(rain)[2] <- "Rainfall"
names(rain)[3] <- "Month"
#ramoili rainfall
rain1<-data.frame(index(core),stack(as.data.frame(coredata(core))))
rain1
head(rain1)
names(rain1)[1] <- "Year"
names(rain1)[2] <- "Rainfall"
names(rain1)[3] <- "Month"
head(rain1)
#ramoili premonsoon rainfall
rain1_pre<-data.frame(index(core[,3:5]),stack(as.data.frame(coredata(core[,3:5]))))
head(rain_pre)
tail(rain1_pre)
names(rain1_pre)[1] <- "Year"
names(rain1_pre)[2] <- "Rainfall"
names(rain1_pre)[3] <- "Month"
#ggplot of two stations gaur and ramoili yearly rainfall of rautahat in same plot
p9 <- ggplot(rain, aes(x =Year, y=Rainfall, size=Rainfall)) + geom_point(shape = 21,color = "#000000", fill = "#40b8d0") +
geom_smooth(aes(fill="Gaur"), colour="darkblue", size=1)
p10 <- p9 + geom_point(data=rain1, aes(x =Year, y=Rainfall, color=Month )) +
geom_smooth(data=rain1, aes(fill="Ramoili"), colour="red", size=1)+
ggtitle(" Yearly rainfall at two stations of Rautahat")+
scale_fill_manual(name="Stations", values=c("blue", "red"))
print(p10)