0
$\begingroup$

I am trying to create a line legend with specific dashing and thickness. Here is the code.

LineLegend[{{Black, Dashing[Tiny], Thickness[0.005]}, {Black, 
   Dashing[Small], Thickness[0.005]}, {Black, Dashing[Large], 
   Thickness[0.005]}, {Black, Thickness[0.005]}, {Black, 
   Thickness[0.01]}}, {"0.001", "0.01", "1", "10", "100"}]

My output is the unevaluated version of my input:

enter image description here

$\endgroup$

1 Answer 1

2
$\begingroup$
LineLegend[
 {
  Directive[Black, Dashing[Tiny], Thickness[0.005]]
  , Directive[Black, Dashing[Small], Thickness[0.005]]
  , Directive[Black, Dashing[Large], Thickness[0.005]]
  , Directive[Black, Thickness[0.005]]
  , Directive[Black, Thickness[0.01]]
  }
 ,
 {"0.001", "0.01", "1", "10", "100"}
 ]

EDIT

The above solves the problem but a more elegant method is to apply Directive to the list of style options that may be provided or are available separately.

styleList = {
   {Black, Dashing[Tiny], Thickness[0.005]}, {Black, Dashing[Small], 
    Thickness[0.005]}, {Black, Dashing[Large], 
    Thickness[0.005]}, {Black, Thickness[0.005]}, {Black, 
    Thickness[0.01]}
   };
labelList = {"0.001", "0.01", "1", "10", "100"};

LineLegend[Directive @@@ styleList, labelList]

Result:

enter image description here

$\endgroup$

Your Answer

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

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