2

Circle grid with different colours and background colours

Could advise on how I would create the image shown? I am not a graphic designer but really need to create something like this. I have no idea even what package to use! Any help would be appreciated.

  • Hi Laura, what program are planning to create this in? What do you mean by "package"? – AndrewH Sep 3 '15 at 16:13
  • Hi, by package I meant program! Sorry for the confusion. I have no experience with any graphics programs but can probably access the more popular ones through my university. Thanks – Laura Sep 3 '15 at 16:14
  • what's the intended use? do you want a flat image? or like a live interactive element for a webpage? or like a vector? :) – binky Sep 3 '15 at 18:56
2

If you are at university then you probably have access to Mathematica, use that. Mathematica allows you to easily do this out of data, within a reporting environment.

dotNred[red_, dot_] := Graphics[{
   Red,
   Table[Rectangle[{-red[[a]] - 0.5, -0.5 + a}, {-0.5, 0.5 + a}], {a, 
     1, 10}],
   EdgeForm[Black],
   Table[{ 
     If[a <= dot[[b]], Black, White],
     Disk[{-a, b}, 0.30]
     }, {a, 1, 10}, {b, 1, 10}
    ]
   }
  ]

redrows = { 8, 3, 0, 0, 0, 0, 0, 0, 0, 0};
dotrows = {10, 0, 0, 0, 0, 0, 0, 0, 0, 0};
dotNred[redrows, dotrows]

Results in Image 1, off course you can generate any number of these with different data points.

enter image description here

Image 1: One possible output

Mathematica does the images in vector form so you can export these to nearly any format you wish.

Ammendum

red can come form oppsite end no problem even black can come form that end if you wish.

dotNred2[red_, dot_] := 
  Graphics[{Red, 
    Table[Rectangle[{red[[a]] - 0.5 - 10, -0.5 + a}, {-10.5, 
       0.5 + a}], {a, 1, 10}], EdgeForm[Black], 
    Table[{If[a <= dot[[b]], Black, White], Disk[{-a, b}, 0.30]}, {a, 
      1, 10}, {b, 1, 10}]}]

redrows = {8, 3, 1, 3, 0, 0, 0, 0, 0, 0};
dotrows = {10, 2, 0, 0, 0, 0, 0, 0, 0, 0};
dotNred2[redrows, dotrows]

enter image description here

Image 2: Different config, ordering is arbitrary

Since you dont describe what the graph is for its hard to make the code work sanely. It might be that you just want 2 different counts inside each other. Then it would be pointless to pass arrays but counts instead. Theers no problem in leaving 2 dots away from top row.

dotNred3[red_, dot_] := 
 Graphics[{Red, 
   Table[Rectangle[{red[[a]] - 0.5 - 10, -0.5 + a}, {-10.5, 
      0.5 + a}], {a, 1, 10}], 
   Table[{If[a > 8 && b == 10, EdgeForm[None], EdgeForm[Black]], 
     If[a <= dot[[b]], Black, White], Disk[{-a, b}, 0.30]}, {a, 1, 
     10}, {b, 1, 10}]}]

redrows = {8, 3, 1, 3, 0, 0, 0, 0, 0, 0};
dotrows = {10, 2, 0, 0, 0, 0, 0, 0, 0, 0};
ImageResize[dotNred[redrows, dotrows], 200]

dots away

Image 3: Even more variation on the theme.

Rest i'm afraid you must do yourself.

  • Hi, that's absolutely fantastic thank you so much! Exactly what I was looking for, plus I am now a Mathematica convert! I have used R for Graphics before but was unsure whether this could be done in R. These programs are much more intuitive to me than Adobe etc. Very grateful to you! – Laura Sep 4 '15 at 9:48
  • @Laura be sure to accept the answer, any answer otherwise this post will haunt us forever. Im sure this could be done in R I certainly can do this in python, postscript and whatnot so why not. – joojaa Sep 4 '15 at 9:59
  • I will do! I just have a couple more questions if you don't mind? Do you know how I could make the number of circles to be 198 (so it wouldn't be a perfect square)? I've changed it to be 200 but I need the last row to have only 18 circles in rather than 20. Also, is there a way to get the red colour to appear on the left rather than the right? Thank you so much! – Laura Sep 4 '15 at 10:19
  • @Laura sure it could be 198 dots but then the addressing should be different. Directions of colors and dots is just a negative number in the code. Amway just so you know there is a separate exchange in form of Mathematica.SE, ill edit the post – joojaa Sep 4 '15 at 10:23
  • Could you explain what you mean by "the addressing should be different"? And yes it would be useful to know how to get the black dots to start from the left too! Sorry for being vague. Essentially the code is for a "population" graph, to show how many people with (black dots) and without (white dots) a disease test positive (shown by the red) on a new diagnostic test. Does this make sense? I have 198 people in my study which is why I need 198 circles! :-) – Laura Sep 4 '15 at 10:50
0

Adobe Illustrator would likely be your best bet, especially if it's readily available at your university. The most basic of beginner tutorials should walk you through enough of the interface to show you how to get this done. If you're not familiar with graphic design programs, this is going to be a very different animal to anything you've worked with before. Don't get discouraged. It's not terribly intuitive, but there is a wonderful community of support here (and out there in the innernets) to help you. Good luck!

  • Thank you! Yes I always find when I post on Stack Exchange that people are very helpful and I always get my question answered successfully! Thanks for your advice! – Laura Sep 4 '15 at 9:52
0

In Adobe Illustrator

Use the Ellipse Tool (L). Draw a circle on the page. Select the circle with the Selection Tool (V) (The black arrow).

Go to Object -> Transform -> Move

Put in distance for horizontal and 0 in for vertical. Click Copy.

Press CTRL + D or Command + D to make the transformation again. When the row is complete, select all of the circles. Go to Object -> Transform -> Move and now make the horizontal 0 and select the distance for vertical.

Now save your artwork

In Adobe InDesign

Use the Ellipse Tool (L). Draw a circle on the page. Select the circle with the Selection Tool (V) (The black arrow).

Go to Edit -> Step and Repeat...

Input the number of circles you want in that row, set vertical to 0 and set the horizontal distance. Click Ok.

select all of the circles. Go back to Edit -> Step and Repeat... and now do another count but with horizontal 0 and set the vertical distance.

In GIMP

Filters → Map → Tile...

  • Andrew, the user can also more easily create a grid of objects in InDesign by dragging the object and pressing simultaneously the ALT and LEFT/RIGHT or UP/DOWN keys – MicroMachine Sep 4 '15 at 1:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.