How do I plot several (milions) of Arrows?

Hi,

I have two huge tables of 3D vectors. Now I want to plot Arrows. I tried to do this

For[i = 1, i < 11, i++, 
 Showt[Graphics[
   Arrow[{seznamcek[[i]], Seznam[[i]] + seznamcek[[i]]}]]]]

But it really doesn’t work the way I Imagined… (it doesn’t work at all). But at least you can see tables: “Seznam” and “seznamcek”. Also, additional question: Those two tables are big (but both the same size). Is it possible do define that For should end when it comes to the end of the table?

Thank you,
cheers

Show is misspelled as Showt.

Even than, it doesn’t work.

Are you able to use ListVectorPlot3D? It seems to automatically draw arrows too.

When I run it, I see the error message “Part::partd: Part specification seznamcek[[1]] is longer than depth of object. >>”, suggesting that seznamcek is empty or hasn’t been defined. It’s hard to say more without seeing more of your program.

Make sure that seznamcek[[i]] and the following point both have the structure of a vector, that is, the argument to Arrow has the structure

 {{a, b,}, {c, d}} or {{a, b, c}, {d, e, f}}.

Even so, For seems to suppress the Graphics output. I don’t know why. Try something like this:

t = Table[Arrow[{{1, 4}, {6, x}}], {x, 1, 10}];

Graphics[t]

If you want the arrows to appear sequentially, use Manipulate or Animate.

For, Do, and similar constructs do not return an output.

http://reference.wolfram.com/language/ref/For.html

With regard to using Show in this, you may want to just construct the list of graphics primitives (the Arrows) and then wrap Graphics around it. For example something like this (but I don’t have your data so I do not know if your seznamcek and Seznam are set up correctly):

Graphics[
Table[
  Arrow[{seznamcek[[i]], Seznam[[i]] + seznamcek[[i]]}], {i, 1, 11}]
]

Also I suggest you graduate from doing this sort of thing procedurally and to it functionally as in the above example.

I hope this helps.

I just wonder what several million arrows on a typical window size plot would look like? If they are more or less evenly distributed on the domain you are just going to get a black plot. Otherwise you are going to get clumpy smears. It will probably need a better treatment than just plotting all the arrows - unless you have some super large display with extra fine detail. What do you expect the field to look like?

One technique might be to select a few hundred arrows at random and try multiple samples.

If there are critical regions you may have to zoom in on them.

One surprisingly effective technique is to generate an Interpolation function (if you can) and plot only a single arrow! But attach it to a movable Locator that you can drag around to explore the field.

Ok firstly, thanks to everybody fur such a great help. I was able to plot those 9621 Arrows. :slight_smile:

Secondly, To David J M Park Jr.:

Hmm, to be honest with you at first I wasn’t really happy with your answer, but after plotting those 9621 Arrows in a 202020 window it got Immediately obvious what you are trying to say.
If I was able to get an analytic solution this everything would never be my problem (I would simply use stream plot or something), but to get analytic solution is more or less impossible, so I got some numerical values and now I want to plot this vector field. Of course, I want to plot it so that I can actually see some things…

Both of your options sound really awesome to me and make me wonder how can I do that? :slight_smile:
Maybe it is possible to correct the code of another David (above your post)? I would like to generate an interpolation but I am afraid that’s a bit too much for my knowledge of mathematica. :confused:

Most of you wanted to have the data: Now it is attached.

One more thing:

Why doesn’t this work?:

ListVectorPlot3D[{{{1, 1, 1}, {2, 3, 5}}, {{2, 3, 1}, {6, 3, 1}}}]

Visualization`Core`ListVectorPlot3D::vfldata: {{{1.,1.,1.},{2.,3.,5.}},{{2.,3.,1.},{6.,3.,1.}}} is not a valid vector field dataset or a valid list of datasets.

I would also like to know the answer. It appears to match the format for a “3d vector plot from vector field values {vx_1, vy_1, vz_1} given at specified points {x_1, y_1, z_1}” (from ?ListVectorPlot3D).

The argument to ListVectorPlot3D needs to be a 3 dimensional array of triples.
Your example is a 2-dimensional array of triples:

In[1]:= Dimensions[{{{1, 1, 1}, {2, 3, 5}}, {{2, 3, 1}, {6, 3, 1}}}]

Out[1]= {2, 2, 3}

That is, you need to have a triple at each point of a 3-dimensional array.

The examples in the Documentation Center give some examples of this.

Where can you see examples?

Because my idea was to plot the vector field using VectorListPlot3D to check if the illustration can be any better. :confused:

The second example at ref/ListVectorPlot3D shows what appears to be a two-dimensional array of triples, one dimension for the point of origin and one for the vector placed at that point.

Yes, I know, I was looking at this example too, but I still don’t understand why this doesn’t want to work with my data?

Can you please correct this example? Maybe than the things will be obvious.

ListVectorPlot3D[{{{1, 1, 1}, {2, 3, 5}}, {{2, 3, 1}, {6, 3, 1}}}]

Apply Dimensions to the array to see its structure.

First example at ref/ListVectorPlot3D

In[73]:= Dimensions[
 Table[{x, y, z}, {x, -1, 1, .1}, {y, -1, 1, .1}, {z, -1, 1, .1}]]

Out[73]= {21, 21, 21, 3}

Second example there:

In[74]:= Dimensions[
 Table[{{x, y, z}, {y, x - x^3, z}}, {x, -1.5, 1.5, 0.2}, {y, -2, 2, 
   0.2}, {z, -1, 1, 0.1}]]

Out[74]= {16, 21, 21, 2, 3}

I don’t get it…

In[102]:= tocke[[1]]

Out[102]= {-100, -100, -100}

In[103]:= Dimensions[tocke[[1]]]

Out[103]= {3}

In[104]:= polje[[1]]

Out[104]= {-5.49968*10^-18, 1.60511*10^-11, -1.60511*10^-11}

In[105]:= Dimensions[polje[[1]]]

Out[105]= {3}

In[106]:= Dimensions[{tocke[[1]], tocke[[1]] + polje[[1]]}]

Out[106]= {2, 3}

Maybe I understand word “Dimension” a lot different than I should or maybe I am sitting behind a computer for too long today.

http://reference.wolfram.com/language/ref/Dimensions.html

This is the form of your input (where each vec is a possibly different 3-vector):

{{vec, vec}, {vec, vec}}

This is an example of the form that is needed for the special case of only two by two vector values:

Table[vec, {x, 0, 1, 1}, {y, 0, 1, 1}, {z, 0, 1, 1}]

gives

{{{vec, vec}, {vec, vec}}, {{vec, vec}, {vec, vec}}}

Note that above each {{vec,vec},{vec,vec}} is a 2x2 planar set of 3-vectors (the first in the x-y plane at z=0the second in parallel to the x-y plane at z=1.

Note that your example will not work if we just put an additional set of list brackets around it since is would only comprise vector field values in a single plane and so the interpolation will have nothing to work with in the 3rd dimension. But this contrived example does work (it replicates your data twice in the z-direction):

ListVectorPlot3D[{{{{1, 1, 1}, {2, 3, 5}}, {{2, 3, 1}, {6, 3, 1}}}, {{{1, 1, 
     1}, {2, 3, 5}}, {{2, 3, 1}, {6, 3, 1}}}}]

In[110]:= Dimensions[{tocke[[1]], tocke[[1]] + polje[[1]], {1, 1, 1}}]

Out[110]= {3, 3}

But I don’t have the third vector {1,1,1} O.o