[R] "Groups" in XYPLOT
Andrew Robinson
A.Robinson at ms.unimelb.edu.au
Sun Mar 18 04:44:15 CET 2007
Hi again Thomas,
ah, sorry, I should be more precise. Please construct a reproducible
worked example that does not require us to download 7 Mb of data. You
might also try the suggestions that I made and let us know if they
worked for you.
Cheers
Andrew
On Sat, Mar 17, 2007 at 10:37:46PM -0500, Thomas Colson wrote:
> Thanks for the warning:
> Here is the link to the datasets, rather large at 2 and 5 mb. Another note
> is that one set has more datapoints than the other, don't know if this can
> be done with xyplot.
> http://www4.ncsu.edu/~tpcolson/coastcurvfreqs.txt
> http://www4.ncsu.edu/~tpcolson/coastslopefreqs.txt
>
> Thomas Colson, PhD
> North Carolina State University
> Department of Forestry and Environmental Resources
> (919)673-8023
> tpcolson at hotmail.com
>
> Schedule: www4.ncsu.edu/~tpcolson
> -----Original Message-----
> From: Andrew Robinson [mailto:A.Robinson at ms.unimelb.edu.au]
> Sent: Saturday, March 17, 2007 10:15 PM
> To: Thomas Colson
> Cc: r-help at stat.math.ethz.ch
> Subject: Re: [R] "Groups" in XYPLOT
>
> Hi Thomas,
>
> sadly, the full code is not much help to us in the absence of the data. Can
> I suggest that you construct a reproducible worked example to help explain
> your question? For what it's worth I suspect that the answer is that you
> need to join these datasets into one and theneitehr use the groups argument,
> or the "+" protocol on the LHS of the plot formula.
>
> Cheers
>
> Andrew
>
> On Tue, Mar 27, 2007 at 04:51:55PM -0500, Thomas Colson wrote:
> > I'm not sure I'm barking up the right tree here, but would I need to
> > make use of groups to plot two separate datasets within ONE panel in
> > xyplot? The desired end result is a single xy plot of two separate
> > (but similar in values and ranges).
> >
> > Full code follows, xyplot code at bottom
> >
> >
> >
> >
> >
> > #########Determine Frequencies
> > ##########coastal_slope
> > #needs the maptools package to read ESRI grid
> > require(maptools)
> > #import the flow slope grid
> > basin.map <- readAsciiGrid("C:/R_PLots/coastal_slp.asc",
> > colname="slope") basin_slope <- (basin.map$slope) #read the slopes
> > into a dataframe
> > freqs<-as.data.frame(table(basin_slope))
> > #rank the frequencies based on each unique occerence, note, ranks from
> > 1 to n
> > r<-rank(freqs$basin_slope)
> > n<-length(r)
> > #determing the probability, n+1 insures there is no 100%, 1- reverses
> > the order so #low slopes gets high probability of exceedence
> > z<-cbind(Rank = r, PRank = 1-(r/(n+1))) #attach the probability to the
> > table, result is high prob of exceed is in row with low slope #and low
> > probabibility is in row with high slope freqs$rank<-z
> > write.table(freqs, "C:/R_PLots/coastslopefreqs.txt", sep=",",
> > col.names=TRUE, row.names=TRUE, quote=TRUE, na="NA")
> >
> > ##########coastal_curvature
> > #needs the maptools package to read ESRI grid
> > require(maptools)
> > #import the curvature grid
> > basin.map <- readAsciiGrid("C:/R_PLots/coastal_crv.asc",
> > colname="curv") basin_curv <- (basin.map$curv) #read the curvs into a
> > dataframe
> > freqs<-as.data.frame(table(basin_curv))
> > #rank the frequencies based on each unique occerence, note, ranks from
> > 1 to n
> > r<-rank(freqs$basin_curv)
> > n<-length(r)
> > #determing the probability, n+1 insures there is no 100%, 1- reverses
> > the order so #low curvature gets high probability of exceedence
> > z<-cbind(Rank = r, PRank = 1-(r/(n+1))) #attach the probability to the
> > table, result is high prob of exceed is in row with low curv #and low
> > probabibility is in row with high curv freqs$rank<-z
> > write.table(freqs, "C:/R_PLots/coastcurvfreqs.txt", sep=",",
> > col.names=TRUE, row.names=TRUE, quote=TRUE, na="NA")
> >
> >
> >
> >
> >
> > ##############Make XYPLOT and export to ps coastcurv <-
> > read.table("C:/R_PLots/coastcurvfreqs.txt", header=TRUE, sep=",",
> > na.strings="NA", dec=".", strip.white=TRUE)
> > xyplot(coastcurv$rank.PRank~coastcurv$basin_curv,scales=list(y=list(lo
> > g=TRUE
> > ,at=c(.0001,.001,.01,.1,1)),x=list(log=TRUE,at=c(0.0001,0.001,0.01,0.1
> > ,1,10)
> > )),xlab="Curvature",ylab="P(C>C*)")
> > dev.copy2eps(file="C:/R_PLots/coastcurv_cad.eps", width=8.0,
> > height=8.0,
> > pointsize=10)
> >
> >
> > ########How to get this in the first plot graphic?
> >
> > coastslope <- read.table("C:/R_PLots/coastslopefreqs.txt",
> > header=TRUE, sep=",", na.strings="NA", dec=".", strip.white=TRUE)
> > xyplot(coastslope$rank.PRank~coastslope$basin_slope,scales=list(y=list
> > (log=T
> > RUE,at=c(.0001,.001,.01,.1,1)),x=list(log=TRUE,at=c(0.0001,0.001,0.01,
> > 0.1,1,
> > 10))),xlab="Slope",ylab="P(S>S*)")
> > dev.copy2eps(file="C:/R_PLots/coastslope_cad.eps", width=8.0,
> > height=8.0,
> > pointsize=10)
> >
> > Thomas Colson, PhD
> > North Carolina State University
> > Department of Forestry and Environmental Resources
> >
> > ______________________________________________
> > R-help at stat.math.ethz.ch 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.
>
> --
> Andrew Robinson
> Department of Mathematics and Statistics Tel: +61-3-8344-9763
> University of Melbourne, VIC 3010 Australia Fax: +61-3-8344-4599
> http://www.ms.unimelb.edu.au/~andrewpr
> http://blogs.mbs.edu/fishing-in-the-bay/
>
> ______________________________________________
> R-help at stat.math.ethz.ch 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.
--
Andrew Robinson
Department of Mathematics and Statistics Tel: +61-3-8344-9763
University of Melbourne, VIC 3010 Australia Fax: +61-3-8344-4599
http://www.ms.unimelb.edu.au/~andrewpr
http://blogs.mbs.edu/fishing-in-the-bay/
More information about the R-help
mailing list