5
$\begingroup$

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?

$\endgroup$
  • 1
    $\begingroup$ You can use Epilog in Graph[] along with Text[] and/or Inset[]. $\endgroup$ – J. M. is away Jul 12 '16 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 Jul 12 '16 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$ – J. M. is away Jul 12 '16 at 22:11
2
$\begingroup$

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:

Grid@numberedImages

Mathematica graphics

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

$\endgroup$
1
$\begingroup$

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

$\endgroup$

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.