What are the four numbers in the `linestyle` vector?

What are the four numbers in

line!( . . . ; linestyle = Linestyle([0.5, 1.0, 1.5, 2.5]), . . . )

found in this documentation ?

I tried this linestyle and got dashed lines, but I’ve got stuck there because I don’t know what each number means.

I searched this forum and Google but didn’t find an explanation.

If there is no explanation, I’ll embark on a detective work and will eventually figure out, but it would be better to find out the documentation if it exists.

(The package I know uses [line, gap, line, gap] specification for a dash, but this doesn’t seem to be the case for Makie.)

I could not find it via search in the docs but

help?> Linestyle
search: Linestyle


  A type that can be used as value for the linestyle keyword argument of plotting functions to arbitrarily customize the linestyle.

  The value is a vector of positions where the line flips from being drawn or not and vice versa. The values of value are in units of

  For example, with value = [0.0, 4.0, 6.0, 9.5] you start drawing at 0, stop at 4 linewidths, start again at 6, stop at 9.5, then
  repeat with 0 and 9.5 being treated as the same position.

So it’s nearly line-gap-line-gap just in position w.r.t. line width (and more in a sum sense than in individual length).


Wonderful @kellertuer ! The “help?>” interface never occurred to me. Next time, I’ll include it in my search range.

1 Like

This is usually also my last fallback; I also first search in the documentation pages and was surprised to not find it there but in the help?> mode.