Dear list users, I modeled the probability of occurrence of one species: "Cyperus dilatatus".
I modeled the species using three different approaches: c("random","target","index") What I want to achieve is to make a plot of all prediction maps in a row with to conditional variables, that is, with the species and the approach I prepared a data.frame to try with the 'levelplot' function. Please find attached a file (levelplot.RData) where I saved the following objects: all.df ---- a data frame with coordinates (s1 and s2), predictions (z), approach used (name), species name (spname) var ---- a numeric vector with the validation value of each model This is my initial code: # ---------------------------------------------------- library(lattice);library(RColorBrewer) load("levelplot.RData") # gray colors for display mypalette = brewer.pal(9, "Greys") # plot levelplot(z ~ s1 + s2 | name * spname, data=df, col.regions=mypalette, at=c(0,.1,.2,.3,.4,.5,.6,.7,.8,1), layout=c(3,1), xlab=NULL, ylab=NULL, scales=list(draw=FALSE)) # ----------------------------------------------------- But now I would like to do some adjustments. For example, I would like to make the font type of the strip where the species name is italic. So I tried initially: #-------------------------------- update(trellis.last.object(), strip=function(...,style,par.strip.text) strip.default(...,style=1,par.strip.text = list(cex=.8, font=3))) #---------------------------------- But then also the strip with the model approach turns into italic font type. So I tried to customize my own strip function like this: #---------------------------------- mystrip <- function(which.given,which.panel,factor.levels,par.strip.text,...){ if (which.given == 1){ par.strip.text = list(cex=.8, font=3) panel.text(x=0.1,y=0,pos=3,lab=factor.levels[which.panel[which.given]]) } if (which.given == 2){ par.strip.text = list(cex=.6, font=1) panel.text(x=0.5, y=0,lab=factor.levels[which.panel[which.given]]) } } update(trellis.last.object(), strip=mystrip) #---------------------------------------- And then everything started going crazy!!! I would also like to add to each panel, as text, the validation value for each prediction. So I tried something like this #----------------------------------------- mypanel = function(x,y,z,subscripts,...){ panel.levelplot(x,y,z,subscripts,...) ltext(150000, 1600000, labels=paste("AUC =", var[subscripts], sep=" "), cex=.7)} update(trellis.last.object(), panel=mypanel) # -------------------------------------- but it displays only the value for the first map, so something is telling me that the use of subscripts is not good. So I tried also with which.packet insted of subscripts with no success. Finally, I would like to make the strip where the name of the species is to appear as a large unique strip and not three times repeated. I hope I am making sense of what I want and looking forward for any help or directions... Best, Jaime -R
______________________________________________ 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.