5

Given a set of Graphics in a grid with frames on all borders of the first and third object:

  GraphicsGrid[{Table[Graphics[Circle[]], {4}]}, 
 Frame -> {None, None, {{1, 1} -> True, {1, 3} -> True}}]

How can I put a frame just on the bottom of those objects? This is probably a trivial problem, but I was not able to figure it out, unfortunately.

EDIT: Generating a frame separately for every single graphic is not feasible in my case, since I'm generating several GraphicsGrids with over a 100 objects automatically based on some data. And depending on whether some criterium is met I want to underline the graphic.

holistic
  • 2,975
  • 15
  • 37

2 Answers2

4

Update

Apply the frame to the individual graphic object.

In order to do this programmatically assume that you have a list of graphic objects and a separate list of Booleans that indicate whether a frame is to be drawn or skipped. The criteria used in the decision can be anything in general as long as you produce a list of Booleans.

I will create a minimal example that duplicates your question.

graphicsList = Table[Graphics[Circle[]], {4}];
criteriaList = {False, True, False, True}

The strategy is to replace the graphics in graphicsList where the same position in criteriaList is True with a frame applied to the bottom of that graphic.

  1. Get the positions

    positions = Position[criteriaList, True] // Flatten
    
  2. Replace the graphics

    graphicsList[[positions]] = 
     graphicsList[[positions]] /. 
      Graphics[g__] -> 
       Graphics[g, Frame -> {{False, False}, {True, False}}, 
        FrameTicks -> None]
    
  3. Plot the results in the grid

    GraphicsGrid[{graphicsList}]
    

Mathematica graphics

Mr.Wizard
  • 271,378
  • 34
  • 587
  • 1,371
Jack LaVigne
  • 14,462
  • 2
  • 25
  • 37
  • Thanks! Applying it separately to every single graphic is not feasible in my case, since I'm generating several GraphicsGrids with over a 100 objects automatically based on some data. And depending on whether some criterium is met I want to underline the graphic. I edited the question about so this becomes more clear :). – holistic Apr 16 '17 at 16:16
  • @holistic Updated to handle the general problem programmatically. – Jack LaVigne Apr 17 '17 at 11:07
  • Great, thanks again :) ! – holistic Apr 17 '17 at 23:17
3

Perhaps something like:

GraphicsGrid[{Table[
   Item[Graphics[Circle[]], Frame -> If[OddQ[i], {{False, False}, {True, False}}, False]], 
   {i, 6}]}]

Mathematica graphics

kglr
  • 394,356
  • 18
  • 477
  • 896