[R] arrows on contour lines

Petr Pikal petr.pikal at precheza.cz
Wed Jan 14 13:38:59 CET 2004


Hi

On 14 Jan 2004 at 12:01, Robin Hankin wrote:

> Hello everybody
> 
> I'm using contour() to draw streamlines of potential flow, eg
> 
>   jj <- seq(from= -4, to=4,len=20)
>   jj <- outer(jj,jj,function(x,y){x})+1i*outer(jj,jj,function(x,y){y})
> 
>   f <- function(x){x^2}
>   contour(Im(f(jj)), nlevels=44 , labels="")

something like that 

contour(Im(f(jj)), nlevels=44 , labels=c(">","<"))

will give you direction.

I would use some coded vector of directions for selecting a direction

> vec<-rep(c(1,2),22)
> set.seed(1)
> vec<-sample(vec,44)
>   contour(Im(f(jj)), nlevels=44 , labels=c(">","<")[vec])

will give you directions.

Hope this helps

Petr

> 
> How best to put arrows on the contour lines to show the direction of
> flow?
>   (ie  I want contour lines looking like ---<---  and ---->----)
> 
> I think this is a lot of work, which I don't mind doing, but it'd be
> good to hear the list's ideas before starting to bark up the wrong
> tree, so to speak.
> 
> 
> 
> -- 
> Robin Hankin
> Uncertainty Analyst
> Southampton Oceanography Centre
> SO14 3ZH
> tel +44(0)23-8059-7743
> initialDOTsurname at soc.soton.ac.uk (edit in obvious way; spam
> precaution)
> 
> ______________________________________________
> 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

Petr Pikal
petr.pikal at precheza.cz




More information about the R-help mailing list