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$ – Tobias Fritzn 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 acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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