zhijie zhang wrote: > Dear friends, > The following is an example to explain my question. I want to get a > legend which will show the z-values according to different colors in image() > function. > > x<-sort(runif(10)) #x-coordinates > y<-sort(runif(10)) #y-coordinates > z<-matrix(runif(100),nrow=10) #attributes values > image(x,y,z,col=gray((6:3)/6)) > # legend(x,y,legend=z,col=gray((6:3)/6)) #error. the colors should denote > different z-values, i want to get this legend. > Hi Zhijie, Have a look at color.legend and color.scale in the plotrix package.
Jim ______________________________________________ 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.