# Putting arrows in 3d plot

How can I put vertical arrows in the center of each cylinder and around them?

CilindrosX = {};
CilindrosY = {};
CilindrosZ = {};

For[a = 1, a < 20, a = a + 2,
For[b = 1, b < 20, b = b + 2, AppendTo[CilindrosX, a]]];

For[a = 1, a < 20, a = a + 2,
For[b = 1, b < 20, b = b + 2,
If[OddQ[(a + 1)/2], AppendTo[CilindrosY, b + 1], AppendTo[CilindrosY, b]]]];

For[a = 1, a <= Length[CilindrosX], a++, AppendTo[CilindrosZ, 1]];

r = 0.25;

CilindrosX = CilindrosX + r*Cos[theta];
CilindrosY = CilindrosY + r*Sin[theta];
CilindrosZ = CilindrosZ*Z;

Data1 = {CilindrosX, CilindrosY, CilindrosZ};

ParametricPlot3D[Data1 // Transpose, {theta, 0, 2 Pi}, {Z, 0, 5},
ImageSize -> Large, PlotRange -> {{9.5, 19.5}, {5.5, 11.5}}]


My plot: How it should be: For vertical arrows I'm trying something like this but I don't know how to save all the arrows to plot later:

CilindrosX = {};
CilindrosY = {};
CilindrosZ = {};

For[a = 1, a < 20, a = a + 2,
For[b = 1, b < 20, b = b + 2, AppendTo[CilindrosX, a]]];

For[a = 1, a < 20, a = a + 2,
For[b = 1, b < 20, b = b + 2,
If[OddQ[(a + 1)/2], AppendTo[CilindrosY, b + 1], AppendTo[CilindrosY, b]]]];

For[a = 1, a <= Length[CilindrosX], a++, AppendTo[CilindrosZ, 1]];

Graphics3D[
Arrow[{{CilindrosX[], CilindrosY[], 0}, {CilindrosX[],
CilindrosY[], 5}}]]

c = 0;

While[c < Length[CilindrosX],
Ar[[c]] =
Graphics3D[
Arrow[{{CilindrosX[[c]], CilindrosY[[c]], 0}, {CilindrosX[[c]],
CilindrosY[[c]], 5}}]]]

• Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! Mar 9 '16 at 3:19
• You can format inline code and code blocks by selecting the code and clicking the {} button above the edit window. The edit window help button ? is also useful for learning how to format your questions and answers. You may also find this this meta Q&A helpful Mar 9 '16 at 3:19

myring[z_] := Graphics3D[
Rotate[
Arrow@Table[{Cos[u], Sin[u], z}, {u, 0, 2 π, 2 π/30}],
{{-1, 0, 0}, {1, 0, 0}}],
Boxed -> False];

myRingSet = Show[Table[myring[z], {z, -1, 1, .2}]];

Show[
Graphics3D[
{
{Opacity[0.5], Cylinder[]},
Arrow[{{0, 0, -1}, {0, 0, 1}}]}}],
myRingSet
] This was a nice one, here is a code that uses some cool features that Mathematica uses. You can go ahead and try it, tamper with it all you want. I included comments so you could see what I was doing. I don't really know how to modify the code so there is a better view of the arrows, but it works fairly well.

Module[{a1 = {}, a2 = {}, coords1 = {}, coords2 = {}, cyls = {}, cylsX = {}, cylsY = {}, cylsZ = {}, d = 0, r = 0.0},

getArrows[coord_, dist_] := Module[{ang = 0.0, angInit = 0.0, coordi = {}, dir = 0.0, lin = {}, numPoints = 0.0, step = 0.0},

(*Define the number of points with which to build the arrow*)
numPoints = 1000.0;

(*Define the angle over which you want to place the arrows and the step size*)
ang = 3.0*Pi/2.0;
step = ang/numPoints;

(*Randomly choose the angle over which you want to start*)
angInit = 2.0*Pi - RandomReal[] 4*Pi;

(*Randomly choose the direction in which the arrow is going*)
dir = 1;
If[RandomReal[] <= 0.5, dir = -dir];

Do[

(*Get the x and y-coordinates of the lines*)
coordi = Append[coordi, {coord[] + dist*Cos[angLin], coord[] + dist*Sin[angLin], 5}];

, {angLin, angInit, angInit + ang, step}];

lin = { Graphics3D[Line[coordi[[1 ;; Length[coordi] - 1]]]]};
lin = Append[lin, Graphics3D[{Arrowheads[0.01],Arrow[{coordi[[Length[coordi] - 1]], coordi[[Length[coordi]]]}]}]];

Return[lin];

];

a1 = Table[a, {a, 2, 20, 2}];
a2 = Table[a, {a, 1, 20, 2}];

(*Make a list of the variables of cylsX*)
cylsX = Table[Table[a, 10], {a, 1, 19, 2}];
Do[If[Mod[i, 2] == 1, cylsY = Append[cylsY, a1],cylsY = Append[cylsY, a2]], {i, 1, 10}];

(*Create the proper arrays*)
cylsX = Flatten[cylsX];
cylsY = Flatten[cylsY];
cylsZ = Table[1, {i, 1, Length[cylsX]}];
cylsZ = Flatten[cylsZ];

Do[coords1 = Append[coords1, {cylsX[[i]], cylsY[[i]], -5}], {i, 1, Length[cylsX]}];
Do[coords2 = Append[coords2, {cylsX[[i]], cylsY[[i]], 5}], {i, 1, Length[cylsX]}];

(*Define the cylinder radius, it can be done above*)
r = 0.25;

Do[cyls = Append[cyls, Graphics3D[{Red, Opacity[0.10], Cylinder[{coords1[[i]], coords2[[i]]}, r]}]], {i, 1,Length[coords1]}];

(*Define the distance at which the arrows should be from the circles*)
d = 0.50;

(*Get the arrows*)
Do[cyls = Append[cyls, getArrows[coords1[[i]], d]], {i, 1, Length[coords1]}];

cyls = Flatten[cyls];

Show[cyls]

] Maybe it's not the most efficient way, but it does what it needs to do.

Ty for answers. I changed a little the code.

StepA = 1;

LimA = 20;

StepB = 4;

LimB = 6;

Raio = 0.5;

EspSetas = 0.03;

Pos1[x_, y_] := -x

Pos2[x_, y_] := y + If[OddQ[(x)], 0, StepB/2]

myring[z_, a_, b_] := Graphics3D[ Rotate[Arrow@ Table[{-Pos1[a, b] + RaioCos[u], Pos2[a, b] + RaioSin[u], z}, {u, 0, 2 [Pi], 2 [Pi]/30}], {{-1, 0, 0}, {1, 0, 0}}], Boxed -> False];

myRingSet = Show[Table[ myring[z, a, b], {z, -1, 1, 0.5}, {a, 0, LimA, StepA}, {b, 0, LimB, StepB}]];

IM = Show[ Graphics3D[{{Red, Opacity[0.10], Table[Cylinder[{{Pos1[a, b], Pos2[a, b], -1}, {Pos1[a, b], Pos2[a, b], 1}}, Raio], {a, 0, LimA, StepA}, {b, 0, LimB, StepB}]}, {Thickness[0.01], Arrowheads[{0, EspSetas}], Table[Arrow[{{Pos1[a, b], Pos2[a, b], -1}, {Pos1[a, b], Pos2[a, b], 1}}], {a, 0, LimA, StepA}, {b, 0, LimB, StepB}]}}], myRingSet, ImageSize -> Large, ImageSize -> 1000];

IM1 = Show[IM, ViewPoint -> {0, 15, 15}, ImageSize -> 1000];

IM2 = Rasterize[ Show[IM, ViewPoint -> {0, 0, [Infinity]}, ImageSize -> 1000]];

Export["C:\Users\Cliente\Desktop\Figuras para o TCC\rede de abrikosov3d.jpg", IM1];

Export["C:\Users\Cliente\Desktop\Figuras para o TCC\rede de abrikosov.jpg", IM2];

Im1 = Import[ "C:\Users\Cliente\Desktop\Figuras para o TCC\rede de abrikosov3d.jpg"];

Im2 = Import[ "C:\Users\Cliente\Desktop\Figuras para o TCC\rede de abrikosov.jpg"];

ImageAssemble[{{Im1}, {Im2}}]


Result: !http://imgur.com/NIqauSB