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.

I want to have thicker lines in the legends of this plot:

historyobjetivomejor = {10, 15, 20, 30, 35}
historyobjetivomedia = {6, 8, 10, 13, 15}
historyobjetivopeor = {6, 3, 5, 7, 8}

ListLinePlot[{historyobjetivomejor, historyobjetivomedia, historyobjetivopeor}, 
  PlotStyle -> {Thickness[0.008]}, 
  AxesLabel -> {"Generacion", "Objetivo"}, 
  LabelStyle -> {24, Bold}, 
  ImageSize -> Large, 
  PlotLegends -> {"Max", "Mea", "Min"}, 
  PlotStyle -> Thickness[0.005], 
  AxesStyle -> Thickness[0.005]]

I was trying with options from other posts, but without good result My last attemp was

ListLinePlot[{historyobjetivomejor, historyobjetivomedia, historyobjetivopeor},  
  PlotStyle -> {Thickness[0.008]}, 
  AxesLabel -> {"Generacion", "Objetivo"}, 
  ImageSize -> Large, 
  PlotLegends -> [{"Max", "Mea", "Min"}, 
  LabelStyle -> {Bold, 20}, 
  LegendMarkerSize -> {40, 10}], 
  PlotStyle -> Thickness[0.005], 
  AxesStyle -> Thickness[0.005]]
share|improve this question

2 Answers 2

up vote 9 down vote accepted

`AbsoluteThickne is another useful approach:e.g.

op = Table[AbsoluteThickness[2], {3}];
leg = LineLegend[Automatic, {"Max", "Mea", "Min"}];
ListLinePlot[{historyobjetivomejor, historyobjetivomedia, 
  historyobjetivopeor}, AxesLabel -> {"Generacion", "Objetivo"}, 
 PlotStyle -> op, PlotLegends -> leg]

enter image description here

Varying thickness: enter image description here

using:

Manipulate[
 ListLinePlot[{historyobjetivomejor, historyobjetivomedia, 
   historyobjetivopeor}, AxesLabel -> {"Generacion", "Objetivo"}, 
  PlotStyle -> Table[AbsoluteThickness[t], {3}], 
  PlotLegends -> leg], {t, Range[2, 5]}]
share|improve this answer
    
+1, much better way. –  rasher Jun 10 at 8:19
    
@ubpdqn Thank you very much :-) Off-topic... :-) A curiosity. How do you create the animated gif? :-) Any suggestion? –  Mika Ike Jun 10 at 8:40
1  
@MikaIke I use LICEcap freeware...here: licecap.en.softonic.com is a site but you can search if does not suit your platform –  ubpdqn Jun 10 at 9:04
    
@ubpdqn Thnk you very much. I´ll try it –  Mika Ike Jun 10 at 9:21

I don't recall a direct way of doing this with normal legending, but you can accomplish same with something like:

ListLinePlot[{historyobjetivomejor, historyobjetivomedia, 
  historyobjetivopeor}, PlotStyle -> {Thickness[0.008]}, 
 AxesLabel -> {"Generacion", "Objetivo"}, LabelStyle -> {24, Bold}, 
 ImageSize -> Large, 
 PlotLegends -> SwatchLegend[Automatic, {"Max", "Mea", "Min"}, 
                   LegendMarkerSize -> {{30, 4}}, 
                   LegendMarkers -> Graphics[{Thickness[.2], Line[{{0, 0}, {10, 0}}]}]], 
 PlotStyle -> Thickness[0.005], AxesStyle -> Thickness[0.005]]

enter image description here

share|improve this answer

Your Answer

 
discard

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

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