Dear all,
?My issue has been resolved, thanks to Byman, a R-sig-Geo member for
the help. Just to refresh my question,/**//*I needed to plot a line
graph of one variable collected over 72 sites(areas) by time (date)
which meant 72 lines on the same graph*/.
?Here is the solution/code below in case others might have similar issue.
/?# Plot several line graphs//
//?library(ggplot2)//
//?library(reshape2)//
//
//?#changes this line below accordingly//
//?dat <- read.table(file.path(""), header = TRUE, sep = ",")//
//
//?#Melt the data for easy plotting//
//?data <- melt(dat, id = c("DISTRICTS_", "area_name", "Year","Quarter",
"Date"))//
//
//?# format the date column//
//?data$Date <- as.Date(data$Date, format = "%d/%m/%Y")//
//?#Subset and select the target variable//
//?g <- ggplot()//
//?g <- g + geom_line(data = data %% filter(variable ==
"Mean.Max.Temp"), aes(x = Date, y = value, group = area_name)) #, colour
= area_name))//
//?####end of script##############/
Line graph with over 70 lines plotted against time-Resolved
1 message · Jailos Lubinda