Re: GRAPHICS IN A DO LOOP DOES NOTHING
- To: mathgroup at smc.vnet.net
- Subject: [mg99532] Re: GRAPHICS IN A DO LOOP DOES NOTHING
- From: David Bailey <dave at removedbailey.co.uk>
- Date: Thu, 7 May 2009 06:36:46 -0400 (EDT)
- References: <gtrkpa$1cn$1@smc.vnet.net>
Alain Mazure wrote:
> Hi
>
> I tried to produce several circles using :
>
> Do[Graphics[Circle[{x[[k]], x[[k]]}, 0.5]], {k, 4}]]
>
> even "wrapping" with Print as explained in post mg78335
>
>
> The command works for an individual set of data and can be superposed
> with Show
> , but how to do with a "large" number.
>
> Graphics[Circle[{x[[1]], x[[1]]}, 0.5]
>
>
> x1= {36.827, 36.5061, 36.1605, 35.8261}
>
>
> y1= {-3.8282, -3.84959, -3.82263, -3.82826}
>
>
Wrapping with Print is the appropriate solution if you need to create a
series of distinct plots - but I think you want to place a series of
circles on one plot:
x1= {36.827, 36.5061, 36.1605, 35.8261};
y1= {-3.8282, -3.84959, -3.82263, -3.82826};
Graphics[Table[Circle[{x1[[k]], y1[[k]]}, 0.5], {k, 1, 4}]]
To see more clearly how this works, you might wish to evaluate the Table
command on its own:
In[8]:= Table[Circle[{x1[[k]], y1[[k]]}, 0.5], {k, 1, 4}]
Out[8]= {Circle[{36.827, -3.8282}, 0.5],
Circle[{36.5061, -3.84959}, 0.5], Circle[{36.1605, -3.82263}, 0.5],
Circle[{35.8261, -3.82826}, 0.5]}
David Bailey
http://www.dbaileyconsultancy.co.uk