9
$\begingroup$

I want to create a multipanel figure like that

enter image description here

and so I would like to add a letter "A", "B", etc to each of the panel I've created. I usually first create each panel with the letter and then assemble them, rather than assemble them and add the letters then:

  • For 2D panels, I am able to do so with the Epilog command:

    Epilog -> Style[Text["B", {1.1, 2.3}], 28, Bold]

but the letter is always on the panel, I can't place it on the left of the panel as is the case on the example above

  • For 3D panels, I am unable at all to use the Epilog command, so I'm looking for a good alternative

I generally use a combination of Column and Row functions to create my multipanel figure then, I find it easier to put the panels exactly where I want to, rather than using Grid or GraphicsGrid.

What solution would you use to add the reference letters to the multipanel figure?

$\endgroup$
6
$\begingroup$

You can also use Panel and its second and third arguments to place the labels:

 Panel[Plot3D[Sin[x + y^2], {x, -3, 3}, {y, -2, 2}, ImageSize -> 200], 
       Style["A", Bold, 14], {{Left, Top}}]

enter image description here

Or, without the frame, (* thanks: @Karsten7. *)

Panel[Plot3D[Sin[x + y^2], {x, -3, 3}, {y, -2, 2}, ImageSize -> 200],
 Style["A", Bold, 14], {{Left, Top}}, Appearance -> "Frameless"]

enter image description here

Examples:

charts = {Plot3D[Sin[x + y^2], {x, -3, 3}, {y, -2, 2}, ImageSize -> 200], 
          BarChart[{{1, 2, 3}, {1, 3, 2}}], 
          Histogram[RandomVariate[WeibullDistribution[2, 1], 1000], Automatic, "Probability"], 
   ContourPlot3D[x^4 + y^4 + z^4 - (x^2 + y^2 + z^2)^2 + 3 (x^2 + y^2 + z^2) == 3, 
    {x, -2, 2}, {y, -2, 2}, {z, -2, 2}, Mesh -> None, 
    ContourStyle -> Directive[Orange, Opacity[0.8], Specularity[White, 30]], 
    ImageSize -> 300]};

labels = CharacterRange["A", "Z"][[;; 4]];
panels = Partition[Panel[#, Style[#2, Bold, 14], {{Left, Top}}] & @@@ 
            Transpose[{charts, labels}], 2];

Grid[panels, Alignment -> {Left, Top}]

enter image description here

$\endgroup$
  • 1
    $\begingroup$ To remove the frame from the Panel one can use the option Appearance -> "Frameless". $\endgroup$ – Karsten 7. Oct 16 '14 at 10:51
  • $\begingroup$ Thank you @Karsten7. -- I knew there was a way and was struggling to remember how. $\endgroup$ – kglr Oct 16 '14 at 14:37
4
$\begingroup$

You can use Labeled to add letters outside the margins of your figures.
E.g.:

plot = Labeled[Framed@Plot[Sin[x], {x, 0, 5}], "A", {{Left, Top}}]

Plot

histo = Labeled[Histogram[RandomVariate[NormalDistribution[], 100]], "B", {{Left, Top}}]

Histogram

sphere = Labeled[Graphics3D[{Sphere[]}], Style["C", 28, Bold], {{Left, Top}}]

3DSphere

Regarding the arrangement, you can start with GraphicsGrid and then rearrange the figures by hand. This needs some clicking around, though.

GraphicsGrid[{{plot, histo}, {sphere}}]

GraphicsGrid

$\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.