I am ploting gridded time series data. I would like the actual lat and lon 
value appear on the graph-if possible inside the graph as numbers. If there is 
also more elegant ways to plot the graphs I will appreciate more suggestions.
#################################
library(ggplot2)
library(lattice)
month <- c("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", 
       "Aug", "Sep", "Oct", "Nov", "Dec")  
month <- factor(month, levels = month.abb)
data <- as.data.frame(expand.grid(lon=seq(4,5, 1), lat=seq(-3,-2,1), 
          year=seq(2010, 2012,1), month=month))
n=nrow(data)
data$prec <- rgamma(n, 2, 0.25)
data$year <- factor(data$year)
data$lon  <- factor(data$lon)
data$lat  <- factor(data$lat)
ndata <- data[order(data$lon, data$lat),]
fix(ndata)
max <- max(ndata$prec, na.rm=TRUE)
min <- min(ndata$prec, na.rm=TRUE)
 
#Plot the graph and save as pdf
pdf("H:/file.pdf")
 
xyplot(prec~month|year+lon+lat, data=ndata, 
   type = c("l", "l","p"), ylim=c(min, max),
       layout=c(1,4))
dev.off() 

 
##############################
#I want to remove the lat and lon rows and put the numbers inside the graph
############################################################################

Peter Maclean
Department of Economics
UDSM
        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to