I'm new to Mathematica and this is also my first post here. Now for the question:
I try to let Mathematica draw a number of rectangles from lists of coordinates. Unfortunately it only works when I assign values to variables directly (for example: a=3
) but not with lists.
Mathematica tells me that the coordinates have to be pairs of numbers (what they are, as far as I understand, because they are in the format {x,y}
).
I imagine something like this:
min = {{1, 1}, {2, 2}, {2, 3}}
Graphics[{EdgeForm[{Thin, Blue}], White,Table[Rectangle[min, {5,5}]]}]
Which I hope should draw three rectangles with different starting points and the same endpoint. This is just chosen as a simple example, later start- and endpoint shall be given via lists.
I've tried few different approaches:
1. A list with coordinates ("min" mentioned earlier) --> error message (see above)
2. Two lists to split x- and y-coordinate --> error message (see above)
3. Using functions to calculate the coordinates (just as a test), which looks like this:
Graphics[{EdgeForm[{Thin, Blue}], White,
Table[Rectangle[{a + 1, a + 2}, {5, 5}], {a, 2}]}] --> works
4. Using a list for iteration, basically I've changed the {a,2} above to {a,minc} with minc beeing minc={{1},{2}} --> error message (see above)
5. Using a list for iteration but try to pick it's elements, leading to {a,Part[minc]} --> error message (see above)
6. Assigned coordiantes to variables directly and used this variables (for example: a=1, b=2, Rectangle[{a,b},{5,5}]) --> works
So, how do I manage to read in coordinates from lists for this application?
Map[]
andMapThread[]
. $\endgroup$ – J. M.'s ennui♦ Jun 15 '15 at 15:04