[Date Index]
[Thread Index]
[Author Index]
Is ListVectorPlot broken in Mathematica 7?
*To*: mathgroup at smc.vnet.net
*Subject*: [mg115527] Is ListVectorPlot broken in Mathematica 7?
*From*: dwynn <ldlafleur at gmail.com>
*Date*: Thu, 13 Jan 2011 03:29:29 -0500 (EST)
(Using Mathematica 7.0.1.0 in Windows Vista)
Consider the 3 X 4 (rows X columns) array of 2-dimensional vectors
created as follows:
In[1]:= vecArray=Table[{(i+4j-4.0),2(i+4j-4.0)},{j,3},{i,4}]
Out[1]= {{{1.,2.},{2.,4.},{3.,6.},{4.,8.}},{{5.,10.},{6.,12.},{7.,14.},
{8.,16.}},{{9.,18.},{10.,20.},{11.,22.},{12.,24.}}}
The array of norms (magnitudes) of the vectors is:
In[2]:= normArray=Map[Norm,vecArray,{2}]
Out[2]= {{2.23607,4.47214,6.7082,8.94427},
{11.1803,13.4164,15.6525,17.8885},{20.1246,22.3607,24.5967,26.8328}}
A contour plot of the norms of the vectors is created by
In[3]:= ListContourPlot[normArray,AspectRatio->Automatic]
The output graph has an x-axis extending from 1 to 4 and a y-axis from
1 to 3. The coordinates of the corners of the graph listed in order
of INCREASING norm values at the corners are (1,1), (4,1), (1,3),
(4,3). This is what I would expect.
A plot of the vectors themselves is created by
In[4]:= ListVectorPlot[vecArray,VectorPoints->All,AspectRatio-
>Automatic]
The output graph has an x-axis extending from 1 to 3 and a y-axis from
1 to 4, i.e., the opposite of the contour graph. Above the x-axis are
three columns of vectors, each containing four vectors. The
coordinates of the corners of the graph listed in terms of increasing
apparent vector size are (1,1), (1,4), (3,1), (3,4). This graph seems
incorrect. It is apparent that it corresponds to the transpose of the
contour plot. Indeed, the following procedure produces a result that
DOES correspond to the contour plot:
In[5]:= vecArrayTr=Transpose[vecArray]
Out[5]= {{{1.,2.},{5.,10.},{9.,18.}},{{2.,4.},{6.,12.},{10.,20.}},
{{3.,6.},{7.,14.},{11.,22.}},{{4.,8.},{8.,16.},{12.,24.}}}
In[6]:= ListVectorPlot[vecArrayTr,VectorPoints->All,AspectRatio-
>Automatic]
The Mathematica documentation seems to predict the opposite. At
http://reference.wolfram.com/mathematica/ref/ListContourPlot.html and
http://reference.wolfram.com/mathematica/ref/ListVectorPlot.html we
read, respectively,
"ListContourPlot[array] arranges successive rows of array up the page,
and successive columns across.";
"ListVectorPlot[array] arranges successive rows of array up the page,
and successive columns across."
These identical specifications of the two commands suggest to me that
the outputs from In[3] and In[4] should match in terms of axes and
locations of vectors without needing the transpose operation.
What am I failing to understand?
L. Dwynn Lafleur
Emeritus Professor of Physics
University of Louisiana at Lafayette
Prev by Date:
**Re: Odd (to me) Context issue with Packages?**
Next by Date:
**Re: How to change the directory for the docs?**
Previous by thread:
**Re: Caution on BibTex references with Mathematica**
Next by thread:
**Inverse function**
| |