MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: ListVectorPlot - plotting at specific points

Whenever you have a List plot, you could also consider drawing the
individual objects in your own Table or by using Map. So here are a set of
random vectors tangent to a sphere:

randomSphereArrow[] :=
  {\[Theta]0 = RandomReal[{0, \[Pi]}],
   \[Phi]0 = RandomReal[{0, 2 \[Pi]}],
   sphere, d\[Theta], d\[Phi], position, direction},
  sphere[\[Theta]_, \[Phi]_] := {Cos[\[Phi]] Sin[\[Theta]], 
    Sin[\[Phi]] Sin[\[Theta]], Cos[\[Theta]]};
  d\[Theta][\[Theta]_, \[Phi]_] = 
   D[sphere[\[Theta], \[Phi]], \[Theta]];
  d\[Phi][\[Theta]_, \[Phi]_] = D[sphere[\[Theta], \[Phi]], \[Phi]];
  position = sphere[\[Theta]0, \[Phi]0];
  direction = 
   0.5 Normalize[
     RandomReal[{-1, 1}] d\[Theta][\[Theta]0, \[Phi]0] + 
      RandomReal[{-1, 1}] d\[Phi][\[Theta]0, \[Phi]0]];
  {Point[position], Arrow[{position, position + direction}]}

 {{Opacity[.6], Orange, Sphere[]},
  Table[randomSphereArrow[], {5}]},
 Lighting -> "Neutral",
 SphericalRegion -> True, RotationAction -> "Clip",
 Boxed -> False

David Park
djmpark at  

From: gopher [mailto:gophergoon at] 

Contrary to the documentation, listing pairs of points and vectors i.e

ListVectorFieldPlot[{{{0, 0}, {1, 1}}}]
gives an error:

ListVectorPlot::vfldata: {{{0,0},{1,1}}} is not a valid vector field
dataset or a valid list of datasets.

.After a lot of searching I found that the deprecated
<< "VectorFieldPlots`"
ListVectorFieldPlot[{{{0, 0}, {1, 1}}}]
does work, but doesn't look as nice, especially the 3d version.
Various settings of the VectorPoints options also don't work. Is there
a solution? I am trying to make some simple examples of vector fields
on spheres to illustrate the Hairy Ball theorem.


  • Prev by Date: Re: Using Mathematica remotely (installed on Mac, to be accessed from X)
  • Next by Date: How to interpret this integral?
  • Previous by thread: ListVectorPlot - plotting at specific points
  • Next by thread: Re: ListVectorPlot - plotting at specific points