I am writing a graph theory paper about forbidden induced subgraphs. My coauthors and I have a list of 167 graphs that we would like to include in a diagram in the paper. I have generated all of these graphs in Mathematica.

I am trying use Mathematica to make the diagram. I would like to put the graphs into a grid (which I have already done using the Grid function). I have a frame around each section of the grid. I would like this grid to be numbered, so that each section has a small number in the corner of the frame. I would also like to label the graphs within each frame with various characters, corresponding to various properties they have. For example, I may want certain graphs toi have an asterisk next to them.

My question is this: is Grid the right way to do this? I don't know a lot of commands and I can't find the answer elsewhere. Grid doesn't seem to be able to put numbers into the corners of the frames.

I can provide more detail if necessary.

I like Sascha's answer about putting the text into a row below below each row of graphs. However I now have the following conundrum: I want to make the rows containing the graphs uniform in size, and I also want the rows containing text to be uniform, but much smaller. How do I control the size of the rows separately?

  • 1
    $\begingroup$ You can use Epilog in Graph[] along with Text[] and/or Inset[]. $\endgroup$ Commented Jul 12, 2016 at 21:25
  • 1
    $\begingroup$ Grid is exactly what you want to use. It takes some tuning but generally is very adaptable. You could for instance put your numbering and text into rows above or beneath a row of individual graphs. $\endgroup$
    – Sascha
    Commented Jul 12, 2016 at 21:26
  • 1
    $\begingroup$ Hi Dave, consider registering so that you don't easily lose the ability to edit your question for clarifications or additions. $\endgroup$ Commented Jul 12, 2016 at 22:11

2 Answers 2


The strategy will be to make a Column that consists of the number at the right with the image below.

First I make some fake image data (this will not be of interest to you).

images = Map[ExampleData[#] &, ExampleData["TestImage"][[1 ;; 8]]];

images = Map[Function[img, ImageTransformation[img, # &, 64]], images];

Now using the list of eight images a new list dimensioned four by two is created that has a number in the upper right hand corner.

numberedImages =  Partition[
  Map[Column[{#, images[[#]]}, Alignment -> Right] &, Range[8]], 2]

Then execute Grid on the result:


Mathematica graphics

You may very well want to Style the numbers to display smaller numbers.


You can also use Labeled and Overlay as follows (using @Jack's example):

img = ImageResize[#, {100, 100}] & /@ ExampleData /@ ExampleData["TestImage"][[;; 8]];

img2 = MapAt[Overlay[{#, Style["*", 40, Red]}, Alignment -> Right] &, 
   img, {{1}, {3}, {5}, {6}, {8}}];
Grid[Partition[MapIndexed[Labeled[#, Style[First@#2, 16], {{Top, Right}}] &, img2], 4], 
    Dividers -> All]

Mathematica graphics

Alternatively, use Panel instead of Labeled:

Panel@Grid[Partition[MapIndexed[Panel[#, Style[First@#2, 16], {{Top, Right}}] &, img2], 4]]

Mathematica graphics


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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