4
$\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$
6
$\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$
  • $\begingroup$ Any other way to do it without using Table? $\endgroup$ – H. Kenan May 15 '18 at 18:43
  • $\begingroup$ @user149973 Table is there only to show you what's available in terms of the variation. $\endgroup$ – rcollyer May 15 '18 at 18:52

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.