5
$\begingroup$

How can I modify the usual curve style DotDashed such that the length of the dashed portion is increased or is controllable? For example in

Plot[Sin[x],{x,0,6.25},PlotStyle-> DotDashed]

$\endgroup$

1 Answer 1

10
$\begingroup$

Dotted, Dashed, and DotDashed all evaluate as they are shorthand for a full Dashing specification. For example,

In[5]:= DotDashed
(*Out[5]= Dashing[{0, Small, Small, Small}]*)

where each element in the List represents a segment. They come in pairs: line length followed by space length. So, for DotDashed there is a 0 length line (the dot) followed by a Small space, and a Small line followed by a Small space. If you want to manipulate the dash length, just change its element in the List:

Table[
 Plot[Sin[x], {x, 0, 2 Pi}, PlotStyle -> Dashing[{0, Small, d, Small}]],
 {d, {Tiny, Small, Medium, Large}}
]

enter image description here

Other explorations can be found here.

$\endgroup$
2
  • $\begingroup$ Any other way to do it without using Table? $\endgroup$
    – H. Kenan
    Commented May 15, 2018 at 18:43
  • $\begingroup$ @user149973 Table is there only to show you what's available in terms of the variation. $\endgroup$
    – rcollyer
    Commented May 15, 2018 at 18:52

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.