4
$\begingroup$

Suppose I have a GraphicsGrid with the following format:

GraphicsGrid[{{Subscript[chart, 1, 1], Subscript[chart, 1, 2]}, {Subscript[chart, 2, 1], Subscript[chart, 2, 2]}, {Subscript[chart, 3, 1], Subscript[chart, 3, 2]}}]

In my grid, each row concerns the same type of information, and I would like to add a centralized heading to each of the three rows. How would I achieve that?

$\endgroup$
1
  • 1
    $\begingroup$ Just in general, I have a bad experience with GraphicsGrid. It seems to have all kinds of bugs if the size of images is not always the same for example. Grid seems to be the most stable alignment tool. If more advance placement is needed, I would embed your figures in a graphics using Inset. $\endgroup$
    – Johu
    Commented Aug 30, 2018 at 21:33

1 Answer 1

3
$\begingroup$

If it is ok to use Grid, you can do

charts = Array[BarChart[Range @ Times[##]] &, {3, 2}];
rowlabels = {"row:" <> ToString[#], SpanFromLeft} & /@ Range[Length @ charts]; 
Grid @ Riffle[rowlabels, charts] 

enter image description here

For labeling each column, you can do:

columnLabels = {"column1", "column2"};
Grid[Prepend[charts, columnLabels]]

enter image description here

$\endgroup$
5
  • $\begingroup$ I think Grid would be fine. But the effect I am looking for is (in your example) not two headings, but one heading placed in the center (in the white space between "column1" and "columns2") $\endgroup$
    – user120911
    Commented Aug 30, 2018 at 20:27
  • 1
    $\begingroup$ @user120911, please see the updated version. $\endgroup$
    – kglr
    Commented Aug 30, 2018 at 20:46
  • $\begingroup$ How do I place my charts (stated above) into the array? I have tried: charts = Array[{{Subscript[chart, 1, 1], Subscript[chart, 1, 2]}, {Subscript[chart, 2, 1], Subscript[chart, 2, 2]}, {Subscript[chart, 3, 1], Subscript[chart, 3, 2]}} &, {3, 2}]; Without the desired effect. $\endgroup$
    – user120911
    Commented Aug 31, 2018 at 7:16
  • 1
    $\begingroup$ @user120911, you can do charts = {{Subscript[chart, 1, 1], Subscript[chart, 1, 2]}, {Subscript[chart, 2, 1], Subscript[chart, 2, 2]}, {Subscript[chart, 3, 1], Subscript[chart, 3, 2]}} or charts = Array[Subscript[chart, ##]&, {3,2}]. $\endgroup$
    – kglr
    Commented Aug 31, 2018 at 7:19
  • $\begingroup$ Selecting the cell finally allows saving the assembled Grid in the desired graphics format. $\endgroup$
    – user120911
    Commented Aug 31, 2018 at 7:46

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.