mtext() is not a lattice function. Could you not use the 'main' argument? Peter Ehlers
Marius Hofert wrote: > Hello, > > I would like to create a sequence of plots (using a for loop). I read > in the FAQ that print() has to be used in order to obtain any output. > This works perfectly fine as long as I only consider one function > call in the loop, but I would like to add mtext() to the each plot in > the loop. Unfortunately, this did not work. Any suggestions? > > As you can see from the provided example, there is another problem > with such animations: You do not see any difference in the plots > (because only the "height" changes). Is there any possibility to keep > a fixed scale for the colorkey (fixed labels and also fixed colors) > and to see the different heights of the function from the colors > (e.g. the first plot should be mainly gray (as it is the "lowest"), > the last one mainly white (as it is the "highest")). > > Thanks very much! > > marius > > Here is a complete minimal example: > > remove(list=objects()) > library(lattice) > for(i in 1:4){ > output_file_path<-paste("~/Desktop/test_",i,".png",sep="") > x<-rep(seq(-3,3,length=50),50) > y<-rep(seq(-3,3,length=50),each=50) > z<-x*y+10*i > trellis.device(png,color=F,file=output_file_path) > print(wireframe > (z~x*y,drape=T,distance=0,zoom=0.84,cuts=100,col.regions=gray > (100:400/400),colorkey=list(tick.number=6))) > #print(mtext(paste("Parameter= ",1,sep=""),side=3,line=0)) #This > does not work! > dev.off() > } > > ______________________________________________ > R-help@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 ______________________________________________ R-help@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