MathGroup Archive 2010

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

Search the Archive

Re: ListVectorPlot - plotting at specific points

  • To: mathgroup at smc.vnet.net
  • Subject: [mg112596] Re: ListVectorPlot - plotting at specific points
  • From: "David Park" <djmpark at comcast.net>
  • Date: Wed, 22 Sep 2010 01:57:07 -0400 (EDT)

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[] :=
 Module[
  {\[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}]}
  ] 


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


David Park
djmpark at comcast.net
http://home.comcast.net/~djmpark/  



From: gopher [mailto:gophergoon at gmail.com] 

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.

Abhishek



  • 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