I'd like to add a label to the top of each column of a GraphicsGrid and to the Left of each Row.

This prior question does not seem to allow rotating the row label.

The Row labels need to be rotated, so the TableForm does not suffice, anyway I also need these to be graphics objects for exporting.

Given is the example output generated below, where the GraphicsGrid is what I am working with:

pl = Table[ListPlot[RandomReal[{0, 1}, 60]], {4}, {6}];

(*Nearly but not rotated*)
TableForm[pl, TableHeadings -> {{"r1 rotated", "r2 rotated", "r3 rotated", "r4 rotated"}, {"c1", "c2", "c3", "c4", "c5", "c6"}}]

(* Ideal if labels added to this *)

Appreciate any hints or tips.

  • 4
    $\begingroup$ why not TableHeadings -> {Rotate[#, 90 Degree] & /@ {"r1 rotated", "r2 rotated", "r3 rotated", "r4 rotated"}, {"c1", "c2", "c3", "c4", "c5", "c6"}}? $\endgroup$
    – kglr
    Commented Dec 29, 2017 at 2:21
  • $\begingroup$ That did the trick. If you want to post the comment as an answer I'll accept it. Otherwise I'll answer with your suggestion if you don't object? $\endgroup$
    – Hedgehog
    Commented Dec 31, 2017 at 3:47
  • $\begingroup$ Hedgehog, posted an answer. $\endgroup$
    – kglr
    Commented Dec 31, 2017 at 3:59

1 Answer 1

pl = Table[ListPlot[RandomReal[{0, 1}, 60]], {3}, {4}];
TableForm[pl, TableHeadings -> 
   {Rotate[#, 90 Degree] & /@ {"r1 rotated", "r2 rotated", "r3 rotated", "r4 rotated"}, 
   {"c1", "c2", "c3", "c4", "c5", "c6"}},
  TableAlignments -> Center]

enter image description here


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.