[R] multiple plots problem

Angel Lopez angel_lul at hotmail.com
Thu Apr 1 17:57:01 CEST 2004


Depends on what you understand by _explicitly_ specify screen number:

par(bg = "white")           # default is likely to be transparent
screenlist<-split.screen(c(3,1))        # split display into three
i<-screenlist[1]

# Create a function to simulate the "tabbing"
nextplot<-function(i)
{
i<-i+1
if (i>screenlist[length(screenlist)]) i<-screenlist[1]
screen(i)
erase.screen(i)
return(i)
}

plot(1:10)
i<-nextplot(i)
plot(2:20)
i<-nextplot(i)
plot(3:30)
i<-nextplot(i)
plot(sin(40:400))
i<-nextplot(i)
plot(sin(4:40))
## Continue your plots
close.screen(all = TRUE)

Oleg Bartunov wrote:
> interesting, it works, but still need to explicitly specify screen number.
> It'b be nice to have tabbed canvas, but I suspect it's wrong list.
> 
> 	Oleg
> On Thu, 1 Apr 2004, Angel Lopez wrote:
> 
> 
>>Have you considered using
>>?split.screen
>>and
>>?erase.screen
>>with a non-transparent background
>>instead of layout.
>>Example:
>>par(bg = "white")           # default is likely to be transparent
>>split.screen(c(3,1))        # split display into three screens
>>screen(1)
>>plot(1:10)
>>screen(2)
>>plot(2:20)
>>screen(3)
>>plot(3:30)
>>
>>screen(1)
>>erase.screen()
>>plot(sin(40:400))
>>
>>Angel
>>
>>Oleg Bartunov wrote:
>>
>>
>>>On Thu, 1 Apr 2004, Duncan Murdoch wrote:
>>>
>>>
>>>
>>>
>>>>On Thu, 1 Apr 2004 15:38:54 +0400 (MSD), Oleg Bartunov
>>>><oleg at sai.msu.su> wrote :
>>>>
>>>>
>>>>
>>>>
>>>>>Hello,
>>>>>
>>>>>for testing & learning purposes I create X11 device and specify layout like
>>>>>layout(c(1,2,3), 3, 1), so I could play with parameters and see
>>>>>several plots at the same time. That works fine until I try to create 4-th
>>>>>plot - all other plots erased. Such behaviour isn't desirable for testing
>>>>>purposes and I'm asking  where to look to disable erasing other plots.
>>>>>
>>>>>
>>>>
>>>>In Windows you can record all plots by using the record=TRUE option
>>>>when you open the graphics display, or from the menu on the display
>>>>window.  You cycle back through the history by hitting the PgUp key.
>>>>
>>>>You're using X11, so you might need to save your plots explicitly
>>>>using recordPlot() and then use replayPlot() to see it again (but your
>>>>front-end might provide access to them more easily, the way Windows
>>>>does).
>>>>
>>>>
>>>
>>>Thanks, looks like too much work :( I just don't understand a logic
>>>why I can't recycle canvas.
>>>
>>>
>>>
>>>
>>>>Duncan Murdoch
>>>>
>>>>
>>>>
>>>
>>>	Regards,
>>>		Oleg
>>>_____________________________________________________________
>>>Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
>>>Sternberg Astronomical Institute, Moscow University (Russia)
>>>Internet: oleg at sai.msu.su, http://www.sai.msu.su/~megera/
>>>phone: +007(095)939-16-83, +007(095)939-23-83
>>>
>>>______________________________________________
>>>R-help at stat.math.ethz.ch mailing list
>>>https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>>>PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>>>
>>>.
>>>
>>>
>>>
>>
> 
> 	Regards,
> 		Oleg
> _____________________________________________________________
> Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
> Sternberg Astronomical Institute, Moscow University (Russia)
> Internet: oleg at sai.msu.su, http://www.sai.msu.su/~megera/
> phone: +007(095)939-16-83, +007(095)939-23-83
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
> 
> .
>




More information about the R-help mailing list