Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

HI I have 5 plots in a Grafics and want to put the Legend in the free space and not to each plot. (as it is always the same legend.) HOw can I do that? Thanks.

Show[Labeled[Framed[GraphicsGrid[{{plot2, plot4}, {plot5, plot3}, {plot1}}]], 
 "Analyses of the different algorithms - Resultgraphics", {Top}]]

The plot is:

plotmedata = 
Table[{(ntotal - ngesundvec[[j]])/ntotal, 
Drop[TransinfResVec, None, {1}][[j]][[i]]}, {j, 1, 
Length[ngesundvec]}, {i, 1, 
None, {1}]\[Transpose] ]}]\[Transpose] // TraditionalForm
plot1 = ListLinePlot[plotmedata[[1]], PlotLabel -> " ", 
BaseStyle -> {FontWeight -> "Bold", 
FontSize -> 12},(*PlotRange->{{ngesundvec[[1]],
PlotStyle -> {Directive[Blue, Thin], Directive[Red, Thin], 
Directive[Black, Thick], Directive[Black, Dashed]}, 
Frame -> True, AspectRatio -> 1, GridLines -> Automatic, 
LabelStyle -> Black, 
FrameLabel -> {"Pretest probability of disease", 
"Mutual information [bit]"}, ImageSize -> 350, 
PlotLegend -> {"Max Inf", "Max Ydn", "LR=1", "Ppost=0.5"}];

Here is the output.

enter image description here

here is my final plot command:

plotinfo = 
 LineLegend[{Blue, Red, Black, Green}, 
  {"Maximum Mutual Information",
   "Maximum Youden Index", "Likelihood Ratio = 1", 
   "P(D+/T+) = 0.5"}, 
  {Epilog -> Text["hier ist der text"]}

 GraphicsGrid[{{plot2, plot4}, {plot5, plot3}, {plot1, plotinfo }}]], 
 "Analyses of the different algorithms - Resultgraphics", {Top}]]

But this does not work: I would like to add some text to the legend. like this

enter image description here

Here is my final plot command:

    GraphicsGrid[{{plot2, plot4}, {plot5, plot3}, {plot1, 
   Framed["μ1[Healthy]:" <> ToString[μ1]], 
   Framed["σ1[Healthy]:" <> ToString[σ1]],
   Framed["μ2[Diseased]:" <> ToString[μ2]], 
   Framed["σ2[Diseased]:" <> ToString[σ2]],
   } }}, 
   Frame -> All], 
  "Analyses of the different algorithms - Resultgraphics", {Top}]]

And I got this result:

enter image description here

share|improve this question
LegendPosition -> {5, 0}. Second example in Documentation. –  Kuba Jun 25 '13 at 11:44
For Mathematica 9+ I would work with SwatchLegend and Inset or Grid for more control. –  Kuba Jun 25 '13 at 11:47
@Kuba: When I use LegendPosition -> {5,0} then the plot becomes so small in the box of the grid position –  Walter Schrabmair Jun 25 '13 at 12:05
@Yes. Thats why I would rather use SwatchLegend. You can wark with this issue be adjusting LegendPosition and ImageSize maybe. –  Kuba Jun 25 '13 at 12:07
@Kuba SwatchLegend works fine, but how can I create a dashed line in the legend then? –  Walter Schrabmair Jun 25 '13 at 12:08
show 6 more comments

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.