how to plot the Partition list data in Mathematica?

Dear all,

I am a new user of mathematica.

I have some data which got from Partition in mathematica, but I don’t know how to plot it as the picture shown below, could anyone help teach me to plot it?

{{{0., 0., 0.}, {-0.554448, 0.656188, -0.511864}}, {{0., 0., 
   1.}, {-0.559555, 0.703101, -0.438803}}, {{0., 0., 2.}, {-0.5273, 
   0.712295, -0.46324}}, {{0., 0., 3.}, {-0.465697, 
   0.744465, -0.478433}}, {{0., 0., 4.}, {-0.522768, 
   0.719231, -0.457625}}, {{0., 0., 5.}, {-0.543862, 
   0.683603, -0.486724}}, {{1., 0., 0.}, {-0.505162, 
   0.687541, -0.52163}}, {{1., 0., 1.}, {-0.535401, 
   0.695653, -0.47897}}, {{1., 0., 2.}, {-0.524684, 
   0.700169, -0.48422}}, {{1., 0., 3.}, {-0.478812, 
   0.739216, -0.473602}}, {{1., 0., 4.}, {-0.486477, 
   0.709122, -0.510378}}, {{1., 0., 5.}, {-0.474792, 
   0.723038, -0.501786}}, {{2., 0., 0.}, {-0.548709, 
   0.667078, -0.50391}}, {{2., 0., 1.}, {-0.547318, 
   0.663301, -0.510367}}, {{2., 0., 2.}, {-0.516255, 
   0.6467, -0.56148}}, {{2., 0., 3.}, {-0.494794, 
   0.706974, -0.505339}}, {{2., 0., 4.}, {-0.474068, 
   0.741548, -0.474728}}, {{2., 0., 5.}, {-0.482781, 
   0.705229, -0.519206}}, {{3., 0., 0.}, {-0.597856, 
   0.605314, -0.525513}}, {{3., 0., 1.}, {-0.6, 
   0.638907, -0.481454}}, {{3., 0., 2.}, {-0.534381, 
   0.666498, -0.519824}}, {{3., 0., 3.}, {-0.523751, 
   0.717818, -0.458719}}, {{3., 0., 4.}, {-0.543924, 
   0.719078, -0.43252}}, {{3., 0., 5.}, {-0.564297, 
   0.670404, -0.481796}}, {{4., 0., 0.}, {-0.619932, 
   0.62298, -0.477054}}, {{4., 0., 1.}, {-0.596892, 
   0.624093, -0.50421}}, {{4., 0., 2.}, {-0.587609, 
   0.664546, -0.461621}}, {{4., 0., 3.}, {-0.629204, 
   0.642922, -0.436753}}, {{4., 0., 4.}, {-0.622141, 
   0.631332, -0.462991}}, {{4., 0., 5.}, {-0.665868, 
   0.575591, -0.474673}}, {{5., 0., 0.}, {-0.66667, 
   0.618194, -0.416397}}, {{5., 0., 1.}, {-0.61844, 
   0.664754, -0.419087}}, {{5., 0., 2.}, {-0.594029, 
   0.645327, -0.480294}}, {{5., 0., 3.}, {-0.608024, 
   0.640567, -0.469021}}, {{5., 0., 4.}, {-0.667069, 
   0.58274, -0.464148}}, {{5., 0., 5.}, {-0.76775, 
   0.519976, -0.374413}}, {{6., 0., 0.}, {-0.678086, 
   0.655006, -0.333418}}, {{6., 0., 1.}, {-0.624181, 
   0.685756, -0.374348}}, {{6., 0., 2.}, {-0.628309, 
   0.613852, -0.477927}}, {{6., 0., 3.}, {-0.6771, 
   0.550492, -0.488358}}, {{6., 0., 4.}, {-0.693756, 
   0.524024, -0.494066}}, {{6., 0., 5.}, {-0.741287, 
   0.549593, -0.385281}}, {{7., 0., 0.}, {-0.619309, 
   0.659949, -0.425351}}, {{7., 0., 1.}, {-0.587752, 
   0.685348, -0.429937}}, {{7., 0., 2.}, {-0.643552, 
   0.613281, -0.45796}}, {{7., 0., 3.}, {-0.716033, 
   0.528534, -0.456014}}, {{7., 0., 4.}, {-0.717883, 
   0.516774, -0.466465}}, {{7., 0., 5.}, {-0.732864, 
   0.531756, -0.424437}}, {{8., 0., 0.}, {-0.634958, 
   0.650951, -0.416042}}, {{8., 0., 1.}, {-0.621014, 
   0.675993, -0.396706}}, {{8., 0., 2.}, {-0.652096, 
   0.643836, -0.400309}}, {{8., 0., 3.}, {-0.717357, 
   0.587399, -0.374648}}, {{8., 0., 4.}, {-0.703421, 
   0.574388, -0.418663}}, {{8., 0., 5.}, {-0.683398, 
   0.584367, -0.437586}}, {{9., 0., 0.}, {-0.60179, 
   0.579024, -0.550072}}, {{9., 0., 1.}, {-0.598156, 
   0.613293, -0.515831}}, {{9., 0., 2.}, {-0.661149, 
   0.646108, -0.381347}}, {{9., 0., 3.}, {-0.656127, 
   0.696351, -0.29085}}, {{9., 0., 4.}, {-0.695973, 
   0.644622, -0.316361}}, {{9., 0., 5.}, {-0.670292, 
   0.59991, -0.436826}}, {{10., 0., 0.}, {-0.566763, 
   0.669403, -0.480291}}, {{10., 0., 1.}, {-0.611619, 
   0.625311, -0.484674}}, {{10., 0., 2.}, {-0.704291, 
   0.627551, -0.331893}}, {{10., 0., 3.}, {-0.649539, 
   0.71374, -0.262058}}, {{10., 0., 4.}, {-0.698806, 
   0.653659, -0.290517}}, {{10., 0., 5.}, {-0.651989, 
   0.652849, -0.385615}}, {{11., 0., 0.}, {-0.669785, 
   0.589218, -0.451897}}, {{11., 0., 1.}, {-0.645654, 
   0.607927, -0.46212}}, {{11., 0., 2.}, {-0.714631, 
   0.602887, -0.354725}}, {{11., 0., 3.}, {-0.754299, 
   0.596464, -0.274342}}, {{11., 0., 4.}, {-0.737249, 
   0.605677, -0.299365}}, {{11., 0., 5.}, {-0.71901, 
   0.553676, -0.420079}}, {{12., 0., 0.}, {-0.653972, 
   0.606627, -0.452023}}, {{12., 0., 1.}, {-0.620618, 
   0.600267, -0.504492}}, {{12., 0., 2.}, {-0.699709, 
   0.573614, -0.42588}}, {{12., 0., 3.}, {-0.737488, 
   0.588048, -0.33213}}, {{12., 0., 4.}, {-0.720453, 
   0.611532, -0.32707}}, {{12., 0., 5.}, {-0.718731, 
   0.575664, -0.389918}}, {{13., 0., 0.}, {-0.60657, 
   0.607946, -0.512323}}, {{13., 0., 1.}, {-0.619851, 
   0.555794, -0.553965}}, {{13., 0., 2.}, {-0.668154, 
   0.574349, -0.472963}}, {{13., 0., 3.}, {-0.672173, 
   0.630932, -0.387439}}, {{13., 0., 4.}, {-0.692549, 
   0.612666, -0.380809}}, {{13., 0., 5.}, {-0.665822, 
   0.601195, -0.441865}}, {{14., 0., 0.}, {-0.596214, 
   0.594012, -0.540073}}, {{14., 0., 1.}, {-0.612741, 
   0.593539, -0.521786}}, {{14., 0., 2.}, {-0.609389, 
   0.56983, -0.551307}}, {{14., 0., 3.}, {-0.606619, 
   0.625419, -0.490779}}, {{14., 0., 4.}, {-0.594598, 
   0.662306, -0.455854}}, {{14., 0., 5.}, {-0.629944, 
   0.617005, -0.471673}}, {{15., 0., 0.}, {-0.537375, 
   0.618406, -0.573413}}, {{15., 0., 1.}, {-0.60263, 
   0.58684, -0.540792}}, {{15., 0., 2.}, {-0.588604, 
   0.611426, -0.52887}}, {{15., 0., 3.}, {-0.578745, 
   0.661086, -0.477514}}, {{15., 0., 4.}, {-0.578269, 
   0.667172, -0.46956}}, {{15., 0., 5.}, {-0.603734, 
   0.637977, -0.478007}}}

In fact, it is a crystal structure, in whose every atomic site, the directions of magnetic moment are plotted.

![Atomic coordinates and magnetic moment1

I

Thank you in advance!

One way:

vectors = <your data>

With[{scale = 2, base = First, vector = Last}, 
 Graphics3D[{Red, Thick, 
   Arrow[{base@#, base@# + scale*vector@#}] & /@ vectors},
  PlotRange -> {Automatic, {0, 5}, Automatic}, Axes -> True]
 ]

Your data has all second coordinates equal to zero. ListVectorPlot3D does not like that, but that function might be useful to you.

Hi, Michael,

Great thanks! It works well. Yes, the atomic second coordinates are zero because it’s a thin film model.

In addition, could you explain this line Arrow[{base@#, base@# + scalevector@#}] & /@ vectors}* for me?
I don’t understand this expression.

Thanks

Hi! You’re welcome.

The code snippet constructs a list of arrows, each of the form Arrow[{basepoint, tip}], one for each pair of triplets in the list vectors which pair I interpreted to be of the form {base, vector}. The tip is calculated by adding the scaled vector to the base point.

I’m not sure which parts need explaining. Here are some pointers to the documentation:

  1. # is short for Slot[1], which together with & forms a Function in which # represents the first argument.

  2. /@ is short for Map, which applies a function to each element of a list and returns the transformed list; in C/Java, one would normally do this with an array and a for-loop.

  3. @ is short for function application, e.g. f@x is the same as f[x].

So the Map makes an Arrow for each pair in the list vectors.

Dear Prof. Rogers, great thanks! It’s my honor that my first question could be answered by you. Your code snippet and explanation is really helpful for me. I have been able to plot my data quickly.