How to plot a hyperbolic vector field in R?

1.1k Views Asked by At

I am trying to plot a vector field like this:

http://www.aanda.org/articles/aa/full/2006/11/aa4228-05/img58.gif

which would have an equation of the form (y2 /b)-(x2 /k)=1,

in a plot something like this (http://math.haifa.ac.il/ROVENSKI/rovenski/images/ROV05_628.gif)

with nice little arrows and such.

Does anyone have any idea how this might be done? Thank you!

1

There are 1 best solutions below

0
IRTFM On
df <- expand.grid(x=seq(-2, 2, .1), y=seq(-2, 2, .1)); k=2; b=4
df$z <- with(df, (y^2)-(x^2) )
library(raster)
library(rasterVis)
r <- rasterFromXYZ(df)
projection(r) <- CRS("+proj=longlat +datum=WGS84")
vectorplot(r, par.settings=RdBuTheme)

enter image description here

Ypu can play around with the arrow sizes. This setting seemed a bit more pleasing on my screen: lwd.arrows=0.3,length=unit(.04, 'npc'))