draw2d
(likewise draw3d
) draws a whole "scene" which is described by its arguments. Everything in the arguments is one "scene". So to create a scene with different things in it, you want to make a list that has all the things you want, and then apply draw2d
to it, i.e., tell Maxima to call draw2d
with that list of arguments.
Here's an example to illustrate that. I'll create a list of all the vectors first. The vector
graphic object takes some options, such as head_type
and so on. I'll make a list with the options I want, and then append the options and the vectors list to get all the arguments I want. Finally I'll call draw2d
to display the scene.
(%i2) load (draw) $
(%i3) myvectors: makelist (makelist (vector([i, j], [i, -j]), j, 1, 5), i, 1, 5);
(%o3) [[vector([1, 1], [1, - 1]), vector([1, 2], [1, - 2]),
vector([1, 3], [1, - 3]), vector([1, 4], [1, - 4]),
vector([1, 5], [1, - 5])], [vector([2, 1], [2, - 1]),
vector([2, 2], [2, - 2]), vector([2, 3], [2, - 3]),
vector([2, 4], [2, - 4]), vector([2, 5], [2, - 5])],
[vector([3, 1], [3, - 1]), vector([3, 2], [3, - 2]),
vector([3, 3], [3, - 3]), vector([3, 4], [3, - 4]),
vector([3, 5], [3, - 5])], [vector([4, 1], [4, - 1]),
vector([4, 2], [4, - 2]), vector([4, 3], [4, - 3]),
vector([4, 4], [4, - 4]), vector([4, 5], [4, - 5])],
[vector([5, 1], [5, - 1]), vector([5, 2], [5, - 2]),
vector([5, 3], [5, - 3]), vector([5, 4], [5, - 4]),
vector([5, 5], [5, - 5])]]
(%i4) vector_options: [head_length = 0.2, head_angle = 15, head_type = empty];
(%o4) [head_length = 0.2, head_angle = 15, head_type = empty]
(%i5) append (vector_options, myvectors);
(%o5) [head_length = 0.2, head_angle = 15, head_type = empty,
[vector([1, 1], [1, - 1]), vector([1, 2], [1, - 2]),
vector([1, 3], [1, - 3]), vector([1, 4], [1, - 4]),
vector([1, 5], [1, - 5])], [vector([2, 1], [2, - 1]),
vector([2, 2], [2, - 2]), vector([2, 3], [2, - 3]),
vector([2, 4], [2, - 4]), vector([2, 5], [2, - 5])],
[vector([3, 1], [3, - 1]), vector([3, 2], [3, - 2]),
vector([3, 3], [3, - 3]), vector([3, 4], [3, - 4]),
vector([3, 5], [3, - 5])], [vector([4, 1], [4, - 1]),
vector([4, 2], [4, - 2]), vector([4, 3], [4, - 3]),
vector([4, 4], [4, - 4]), vector([4, 5], [4, - 5])],
[vector([5, 1], [5, - 1]), vector([5, 2], [5, - 2]),
vector([5, 3], [5, - 3]), vector([5, 4], [5, - 4]),
vector([5, 5], [5, - 5])]]
(%i6) apply (draw2d, %);
Of course, you can redo the example with the number of vectors equal to 21^2 instead of 5^2, and you can change the options as you want. You can also create other graphic objects and append them to the arguments list and then apply draw2d
to all the arguments.