Skip to content
Back to formatted view

Raw Message

Message-ID: <CAM_vjum9kJUSv9cUOtebdsztDgbra4rqs937nyCarzQo+X+JKQ@mail.gmail.com>
Date: 2011-11-02T19:29:43Z
From: Sarah Goslee
Subject: HOW TO REMOVE MTEXT FROM PLOT, plotting changing populations with titles in loop
In-Reply-To: <1320261304220-3981757.post@n4.nabble.com>

It's not perfect, but you could use:

mtext(paste("this is iteration ", i, sep=""), col="white")

to overwrite it, or polygon() to draw a white rectangle over the text each time.

Sarah

On Wed, Nov 2, 2011 at 3:15 PM, prinzOfNorway <torgrimsby at gmail.com> wrote:
> is there a way to hide/undraw mtext (or lines etc.) in a loop like
>
> plot(runif(10))
> iterCol <- rainbowPalette(10)
>
> for(i in 1:10){
>
> mtext(paste("this is iteration ", i, sep=""))
> points(runif(10),col=iterCol[i])
> Sys.sleep(1)
>
> ## UNDRAW/HIDE the text so that it does not mess up the plot in the next
> iteration
>
> }
>

-- 
Sarah Goslee
http://www.functionaldiversity.org