Dashing[{r1,r2,…}]
is a two-dimensional graphics directive specifying that lines that follow are to be drawn dashed, with successive segments of lengths r1, r2, … (repeated cyclically). The ri are given as a fraction of the total width of the graph.
Dashing[{r1,r2,…},offset]
offsets the dashes by offset.
Dashing
Dashing[{r1,r2,…}]
is a two-dimensional graphics directive specifying that lines that follow are to be drawn dashed, with successive segments of lengths r1, r2, … (repeated cyclically). The ri are given as a fraction of the total width of the graph.
Dashing[{r1,r2,…},offset]
offsets the dashes by offset.
Details
- Dashing can be used in both two- and three-dimensional graphics, as well as in Style specifications.
- Dashing[{}] specifies that lines should be solid. »
- The following symbolic forms for r can be used: Tiny, Small, Medium, and Large. These specify absolute segment lengths independent of the total width of the graphic. »
- If a segment has a length ri specified as 0, it is drawn as a dot whose diameter is the thickness of the line. »
- offset is specified as a fraction of the total width of the graph, and it may be positive or negative. If offset is not specified, it is 0.
- capform can take any of the legal form values in CapForm[form]. If not specified, all segments will be drawn with the "Butt" cap form.
Examples
open all close allBasic Examples (4)
Specify the dashing of lines as successive segments with scaled lengths:
Table[Graphics[{Dashing[{r, 0.1 - r}], Line[{{0, 0}, {2, 1}}]}], {r, {0.01, 0.03, 0.05, 0.08}}]Table[Graphics3D[{Dashing[{r, 0.1 - r}], Line[{{0, 0, 0}, {2, 1, 1}}]}], {r, {0.01, 0.03, 0.05, 0.08}}]Set the dashing of edges of polygons:
p2 = Polygon[{{-1, 0}, {0, Sqrt[3]}, {1, 0}}];Table[Graphics[{Pink, EdgeForm[Dashing[r]], p2}], {r, {0.01, 0.05, 0.1}}]p3 = Polygon[{{1, 0, 0}, {0, 0, 1}, {1, 1, 1}}];Table[Graphics3D[{Pink, EdgeForm[{Dashing[r]}], p3}], {r, {0.01, 0.05, 0.1}}]Set the dashing of lines in plots using PlotStyle:
Plot[{Sin[x], Cos[x]}, {x, 0, 2 π},
PlotStyle -> {Dashing[Tiny], Dashing[Large]}]Grid[Table[x, {4}, {7}], Frame -> All, FrameStyle -> Dashing[Tiny]]Scope (8)
Dashing Specifications (5)
Graphics[{Dashing[{}], Line[{{0, 0}, {2, 1}}]}]Dashing[r] is equivalent to Dashing[{r,r}]:
Table[Graphics[{Dashing[r], Line[{{0, 0}, {2, 1}}]}], {r, {0.01, 0.03, 0.05, 0.08}}]Symbolic values for predefined absolute dashings:
Table[Graphics[{Dashing[r], Line[{{0, 0}, {2, 1}}]}], {r, {Tiny, Small, Medium, Large}}]Specify multiple cyclic segments:
Graphics[{Dashing[{0.1, 0.02, 0.05}], Line[{{0, 0}, {2, 1}}]}]Specify offset to dashed segments:
Table[Graphics[{Line[{{0, 0}, {2, 1}}], Dashing[{.1, .05}, o], Red, Opacity[.5], Thickness[.05], Line[{{0, 0}, {2, 1}}]}], {o, {-0.05, 0, 0.05}}]Specify caps to dashed segments:
Table[Graphics[{Line[{{0, 0}, {2, 1}}], Dashing[{.1, .1}, 0, CapForm[c]], Red, Opacity[.5], Thickness[.05], Line[{{0, 0}, {2, 1}}]}], {c, {"Round", "Butt", "Square"}}]Primitives Affected (3)
Specify the dashing of the shaft of an arrow:
Graphics[{Dashing[0.02], Arrow[{{0, 0}, {2, 1}}]}]Specify the dashing of edges of primitives using EdgeForm:
Table[Graphics[{Pink, EdgeForm[Dashing[r]], Disk[]}], {r, {0.01, 0.05, 0.1}}]Table[Graphics[{Pink, EdgeForm[Dashing[r]], Rectangle[]}], {r, {0.01, 0.05, 0.1}}]Specify the dashing of 3D primitive edges using EdgeForm:
Table[Graphics3D[{Pink, EdgeForm[Dashing[r]], Cylinder[]}, Boxed -> False], {r, {0.01, 0.05, 0.1}}]Table[Graphics3D[{Pink, EdgeForm[Dashing[r]], Cuboid[]}, Boxed -> False], {r, {0.01, 0.05, 0.1}}]Properties & Relations (6)
Use Dashed, Dotted, and DotDashed to specify predefined absolute dashings:
{Graphics[{Dashed, Line[{{0, 0}, {2, 1}}]}], Graphics[{Dotted, Line[{{0, 0}, {2, 1}}]}], Graphics[{DotDashed, Line[{{0, 0}, {2, 1}}]}]}Dashing defines the length of a segment as a fraction of the total width of the graphic:
Graphics[{Thick, Dashing[{0.05, 0.1}], Line[{{-1, 0}, {1, 0}}]}, Frame -> True]Dashing depends on the image size:
Table[Graphics[{Dashing[.05], Line[{{0, 0}, {2, 1}}]}, ImageSize -> s], {s, {50, 100, 150}}]AbsoluteDashing defines the length of a segment in units of printer's points:
Graphics[{Thickness[.02], AbsoluteDashing[{15}], Line[{{0, 0}, {1, 0}}], Text[Style["15 points", FontSize -> 15], {0.5, 0.1}]}]AbsoluteDashing is independent of the image size:
Table[Graphics[{AbsoluteDashing[10], Line[{{0, 0}, {2, 1}}]}, ImageSize -> s], {s, {50, 100, 150}}]The thickness of segments can be specified by Thickness:
Table[Graphics[{Thickness[r], Dashing[Medium], Line[{{0, 0}, {2, 1}}]}], {r, {0.01, 0.03, 0.05}}]A segment with length 0 specifies a dot of the size defined by Thickness:
Graphics[{Thickness[.05], Dashing[{0, 0.1}], Line[{{0, 0}, {2, 1}}]}]Dashing overrides the CapForm directive:
Graphics[{Dashing[{.2, .15}], CapForm["Round"], Thickness[.1], Line[{{0, 0}, {1, 1}}]}]Specify the third argument to Dashing to set a cap form for all dashes:
Graphics[{Dashing[{.2, .15}, 0, "Round"], Thickness[.1], Line[{{0, 0}, {1, 1}}]}]Possible Issues (1)
Neat Examples (3)
Graphics[Table[{Hue[RandomReal[]], Dashing[RandomReal[{0, 0.07}]], Circle[RandomReal[1, {2}], RandomReal[]]}, {20}]]A curve with a random dash pattern:
ParametricPlot[t{Cos[t], Sin[t]}, {t, 0, 50}, PlotStyle -> Directive[Thick, Dashing[RandomReal[{0, 0.05}, 100]]]]Vary the offset for dashed rays out of the origin:
Animate[Graphics[{Dashing[{.04, .04}, a], Table[Line[{{0, 0}, {Cos[b], Sin[b]}}], {b, 0, 2 π, π / 20}]}], {a, 0.64, 0}]Tech Notes
Related Guides
History
Introduced in 1988 (1.0) | Updated in 2007 (6.0) ▪ 2021 (12.3)
Text
Wolfram Research (1988), Dashing, Wolfram Language function, https://reference.wolfram.com/language/ref/Dashing.html (updated 2021).
CMS
Wolfram Language. 1988. "Dashing." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2021. https://reference.wolfram.com/language/ref/Dashing.html.
APA
Wolfram Language. (1988). Dashing. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Dashing.html
BibTeX
@misc{reference.wolfram_2026_dashing, author="Wolfram Research", title="{Dashing}", year="2021", howpublished="\url{https://reference.wolfram.com/language/ref/Dashing.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_dashing, organization={Wolfram Research}, title={Dashing}, year={2021}, url={https://reference.wolfram.com/language/ref/Dashing.html}, note=[Accessed: 12-June-2026]}