1
$\begingroup$

I have read all these posts and can not get this to work. I am trying to increase the width of the line in the legend. I have tried SwatchLegend, PlotLegends->LegendMarkerSize->20... I have tried various versions and setups. I even tried having a legend value that has all the settings and it does nothing. the new thing I am trying is "LegendLineWidth" -> 35 or "LegendMarkerSize"->20... or use LegendApperance->... No changes.

Here is my code...

Needs["PlotLegends`"]

life1 = ((1/t) - 0.003214)*(1/45)

life2 = ((1/t) - 0.006429)*(1/45)

life3 = ((1/t) - 0.009643)*(1/45)

life4 = ((1/t) - 0.012857)*(1/45)

life5 = ((1/t) - 0.03214)*(1/45)

life6 = ((1/t) - 0.06429)*(1/45)

life7 = ((1/t) - 0.09643)*(1/45)

life8 = ((1/t) - 0.12857)*(1/45)

LogPlot[{life1, life2, life3, life4, life5, life6, life7, life8}, {t, 
  0, 250}, PlotRange -> {1*10^-5, 10^-1}, Frame -> True, 
 FrameLabel -> {"Time (s)", "LpB"}, 
 RotateLabel -> True, 
 BaseStyle -> {FontFamily -> "Helvetica", FontSize -> 12}, 
 PlotStyle -> {{Red, Thickness[Medium]}, {Blue, Dashing[{Large}], 
    Thickness[Medium]}, {Yellow, Dashing[{Medium}], 
    Thickness[Medium]}, {Black, Dashing[{Small}], 
    Thickness[Medium]}, {Orange, Dashing[{Tiny}],
    Thickness[Medium]}, {Green, DotDashed, Thickness[Large]}, {Cyan, 
    Thin}, {Purple, Thickness[Large]}}, 
 LegendAppearance -> {LegendMarkerSize -> 40}, 
 PlotLegend -> {Style["0.025mm", 14], Style["0.05mm", 14], 
   Style["0.075mm", 14], Style["0.1mm", 14], Style["0.25mm", 14], 
   Style["0.5mm", 14], Style["0.75mm", 14], Style["1.0mm", 14]}, 
 LegendPosition -> {0, 0.2}, LegendShadow -> None, 
 LegendSize -> {0.95, 0.4}, LegendBorder -> None, 
 LegendTextSpace -> 6, ImageSize -> Large]

enter image description here

$\endgroup$
  • $\begingroup$ What Mathematica version are you using? The PlotLegends package is outdated. $\endgroup$ – Jens Mar 24 '15 at 19:06
  • $\begingroup$ I get a nice plot using the code in my answer here and doing Show[autoLegend[p,{Style["0.025mm",14],Style["0.05mm",14],Style["0.075mm",14],Style["0.1mm",14],Style["0.25mm",14],Style["0.5mm",14],Style["0.75mm",14],Style["1.0mm",14]},Alignment->{.5,.5}], ImageSize->Large] where I called your plot p, re-done without all the Legend... commands. You don't need the PlotLegend package if you use my functions. $\endgroup$ – Jens Mar 24 '15 at 19:12
1
$\begingroup$

If you have version 9 or higher, you can use the option PlotLegends and set its value to LineLegend[...] and use the LegendMarkerSize option inside LineLegend:

lives = (1/t - {0.003214, , 0.006429, 0.009643, 0.012857, 0.03214, 
      0.06429, 0.09643, 0.12857})/45;
leglabels = Style[#, 14] & /@ {"0.025mm", "0.05mm", "0.075mm", "0.1mm", 
    "0.25mm", "0.5mm", "0.75mm", "1.0mm"};
pstyle = {{Red, Thickness[Medium]}, {Blue, Dashing[{Large}], 
    Thickness[Medium]}, {Yellow, Dashing[{Medium}], 
    Thickness[Medium]}, {Black, Dashing[{Small}], 
    Thickness[Medium]}, {Orange, Dashing[{Tiny}], 
    Thickness[Medium]}, {Green, DotDashed, Thickness[Large]}, {Cyan, 
    Thin}, {Purple, Thickness[Large]}};

LogPlot[Evaluate@lives, {t, 0, 250}, PlotRange -> {1*10^-5, 10^-1}, 
 Frame -> True, FrameLabel -> {"Time (s)", "LpB"}, RotateLabel -> True,
 BaseStyle -> {FontFamily -> "Helvetica", FontSize -> 12}, PlotStyle -> pstyle, 
 PlotLegends -> LineLegend[leglabels, LegendMarkerSize -> {40, 12}], 
 ImageSize -> Large]

enter image description here

Note: LegendAppearance is an option for charting functions; it doesn't work in plotting functions.

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