Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1999
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1999

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Drawing Rectangular Grid

  • To: mathgroup at smc.vnet.net
  • Subject: [mg20223] Re: [mg20198] Drawing Rectangular Grid
  • From: BobHanlon at aol.com
  • Date: Wed, 6 Oct 1999 21:06:39 -0400
  • Sender: owner-wri-mathgroup at wolfram.com

Wilson,

grid[{rows_Integer, cols_Integer}, disks_List] := 
    Module[{j, k, diskRadius = .3}, 
      Show[Graphics[
          Join[Table[{Hue[Mod[j + k, 2]/2], 
                Rectangle[{k - 1, j - 1}, {k, j}]}, {j, rows}, {k, cols}], 
            Disk[{#[[1]] - 1/2, #[[2]] - 1/2}, diskRadius] & /@ disks], 
          AspectRatio -> 1]]];

filled = {{1, 3}, {4, 6}, {8, 8}};

grid[{8, 8}, filled];

Bob Hanlon

In a message dated 10/5/1999 8:10:21 AM, flip at aznet.net writes:

>I was hoping someone here could help.  I am writing some code for a
>Cellular Automata Simulator.
>
>I would like to have a function that I can give the following
>information to:
>
>Grid[size_of_grid, matrix_of_cells_to_fill]
>
>This function will draw a n x m rectangular grid = size (for example
>size = {2,2} for a 2 x 2 grid).
>
>I then will pass an array of the cells to be filled.  For example
>{{1,1},{2,2}}.  It could also be {{1,1},{1,2},{2,1},{2,2}}, in which
>case the whole grid will have filled cells.
>
>The Grid function will then return a Rectangular Grid with the cells
>(1,1) and (2,2), which are the diagonal cells filled in as either black
>cells or, better yet, as filled in circles that are smaller in size than
>the square grid cell size. (Little circles enclosed within the grid
>cells).
>
>Can someone help me with this function (I don't think that such a thing
>would be difficult for an experienced Mathematica user, but one never knows).
>


  • Prev by Date: Re: simplifying expressions
  • Next by Date: Problem Printing Rational Numbers
  • Previous by thread: Drawing Rectangular Grid
  • Next by thread: Re: Drawing Rectangular Grid