[R] Image to plot

Jim Lemon jim at bitwrit.com.au
Tue Feb 8 09:15:37 CET 2011


On 02/08/2011 12:09 AM, Alaios wrote:
> Hello again,
> actually I am trying to store many files to hard disk and thus I want to
> 1.create new plot
> 2.save it
> 3. close it
>
> I have successfuly completed 1 and 2 but when I try to close it
>
> color2D.matplot(tespa,redrange=c(0,1),greenrange=c(0,.5),bluerange=c(0,.5),xlab="x",ylab="y",main=sprintf("TestTitlos %d",2),show.legend=TRUE,show.values=TRUE)
> dev.off(dev.cur())
>
> it doesnot.
> it seems for me that it takes some time until color2D.matplot is printed out and thus when dev.off(dev.cur()) is issued has nothing to close.
>
> What should I try to do for that?
>
Hi Alex,
I'm a bit mystified by this, the following works okay for me:

values<-matrix(sample(1:50,36),6,6)
cellcolors<-matrix(sample(colors(),36),6,6)
png("testcolmat.png")
color2D.matplot(values,cellcolors=cellcolors,show.values=TRUE)
dev.off(dev.cur())

Jim



More information about the R-help mailing list