RE: Problem using a loop to generate data for Point function
- To: mathgroup at smc.vnet.net
- Subject: [mg35620] RE: [mg35602] Problem using a loop to generate data for Point function
- From: "David Park" <djmp at earthlink.net>
- Date: Tue, 23 Jul 2002 01:51:25 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Michael, If you put the Show statement in the loop, then you are going to get multiple plots. You want to first assemble the Points and then use one Show statement. Also, it is much easier to use the Mathematica functional programming. Here are two ways to obtain a list of Points. pts = Table[Point[{i, i}], {i, 9}] {Point[{1, 1}], Point[{2, 2}], Point[{3, 3}], Point[{4, 4}], Point[{5, 5}], Point[{6, 6}], Point[{7, 7}], Point[{8, 8}], Point[{9, 9}]} pts = Point[{#, #}] & /@ Range[9] {Point[{1, 1}], Point[{2, 2}], Point[{3, 3}], Point[{4, 4}], Point[{5, 5}], Point[{6, 6}], Point[{7, 7}], Point[{8, 8}], Point[{9, 9}]} Then use just one Show statement... Show[Graphics[{ AbsolutePointSize[3], pts}], Frame -> True]; Or you could put the Table directly in the Show statement. Show[Graphics[{ AbsolutePointSize[3], Table[Point[{i, i}], {i, 9}]}], Frame -> True]; David Park djmp at earthlink.net http://home.earthlink.net/~djmp/ From: Michael Carnright [mailto:carnright at yahoo.com] To: mathgroup at smc.vnet.net For[i = 1, i < 10, i++, Show[Graphics[Point[{i, i}]]]] This genereates nine graphics with one point each. I was trying to generate one graphic with nine points. I see my problem as calling the Point function nine times instead of only once. I wish to use the data generated by the loop on a single graphic. Thanks in advance for help on this :) P.S. In the end I will be doing three For loops in a nested formation to generate the data to put on one graphic. -Michael