[R] xyplot help
Duncan Mackay
mackay at northnet.com.au
Wed Feb 20 13:22:41 CET 2013
Hi Peter
As for more suggestions
library(latticeExtra)
useOuterStrips(
xyplot(prec~month|year*paste(lat,lon), data=ndata,
as.table = T,
type = c("l", "l","p"), ylim=c(min, max),
layout=c(1,4)) )
have a look at
?strip.custom and ?strip.default as well as ?useOuterStrips for
customizing the strips
and ?panel.text for within the panel.
HTH
Duncan
Duncan Mackay
Department of Agronomy and Soil Science
University of New England
Armidale NSW 2351
Email: home: mackay at northnet.com.au
At 18:13 20/02/2013, you wrote:
>Content-Type: text/plain
>Content-Disposition: inline
>Content-length: 1370
>
>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 at 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.
More information about the R-help
mailing list