23
$\begingroup$

I am using this code to plot a graph, and I am trying to make the font of the legend bigger.

<<PlotLegends`
ListLogLogPlot[{Sort[moby]}, PlotRange -> Full, Joined -> True, 
    PlotLegend -> {"Moby Dick"}, LegendPosition -> {0.30, -0.20}, LegendShadow -> None, 
    LegendBorder -> None, PlotStyle -> {Dashed}, BaseStyle -> {FontSize -> 14}]

This only seems to change the font size of the labels on my axis. But I also want the legend to be size 14.

$\endgroup$

3 Answers 3

27
$\begingroup$

Try using Style in the option values for PlotLegend->{...}. For example:

  Plot[{Sin[x], Cos[x]}, {x, 0, 2 Pi}, 
  PlotLegend -> {Style["sine", Red, Bold, 18], "cosine"},  
  LegendLabel -> None]

gives:

enter image description here

$\endgroup$
1
  • 3
    $\begingroup$ Is there also a way to do the same thing for all entries in the legend at once, you think? I have a plot with five function in the same graph, and there must be a simpler way than using Style five times. $\endgroup$
    – Jelle
    May 8, 2013 at 15:43
7
$\begingroup$

In case you have multiple legends, just use an explicit pure function:

PlotLegend -> Style[#, Red, Bold, 18] & /@ {"apple", "pear", "grape"}
$\endgroup$
1
  • $\begingroup$ minor comment - you need to use PlotLegends after v9 and wrap the above pure function in ( )'s or else you get an error ie, PlotLegends -> ( Style[#, Red, Bold, 18] & /@ {"apple", "pear", "grape"} ) $\endgroup$
    – Joe
    Mar 27, 2019 at 20:30
0
$\begingroup$

Use LabelStyle to format automatic legends, which will affect legends only and will not affect frame labels and title, for them use respective thread@style, while BaseStyle have no affect at all on any of them, for example:

...
PlotStyle -> {Red, Blue, Green, 
  Brown}, LabelStyle -> {FontSize -> 
   7}, ImageSize -> 800, Frame -> True, FrameLabel -> 
 Thread@Style[{"q", "SK KT NS SF"}, 
   7], FrameTicks -> All, GridLines -> Automatic, AspectRatio -> 
 2/4, PlotLabel -> 
 Pane[Thread@
   Style[{"SK", "KT", "NS", "SF"}, {Red, Blue, Green, Brown}, 7], 500,
   Alignment -> Center], PlotLegends -> "AllExpressions"
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.