CapForm[type]
is a graphics primitive that specifies what type of caps should be used at the ends of lines, tubes, and related primitives.
CapForm
CapForm[type]
is a graphics primitive that specifies what type of caps should be used at the ends of lines, tubes, and related primitives.
Details
- The following types can be used in CapForm[type]:
-
"Butt" truncate at the end point "Round" put a half-disk at the end point "Square" put a half-square at the end point None equivalent to "Butt" - CapForm works in both 2D and 3D.
- In 2D, the default is CapForm["Square"]. In 3D, the default is CapForm["Round"].
- CapForm applies to Line, Tube, Circle, and Arrow.
- CapForm specifications are ignored where an arrowhead appears.
- CapForm[None] leaves 3D shapes open at their end points.
Examples
open all close allBasic Examples (2)
Scope (3)
Table[Graphics[{CapForm[cap], Thickness[.2], Line[{{-1, -1}, {1, 1}}]}, PlotRange -> 1.5, PlotLabel -> cap], {cap, {"Butt", "Round", "Square"}}]Table[Graphics3D[{CapForm[cap], Thickness[.1], Line[{{-1, -1, -1}, {1, 1, 1}}]}, PlotRange -> 1.5, PlotLabel -> cap], {cap, {"Butt", "Round", "Square"}}]Specify caps of circular arcs:
Table[Graphics[{CapForm[cap], Thickness[.2], Circle[{0, -1}, 1, {Pi / 6, 5Pi / 6}]}, PlotRange -> 1.5, PlotLabel -> cap], {cap, {"Butt", "Round", "Square"}}]Table[Graphics3D[{CapForm[cap], Tube[{{-1, -1, -1}, {1, 1, 1}}, 0.2]}, PlotRange -> 1.5, PlotLabel -> Row[{cap}]], {cap, {None, "Butt", "Round", "Square"}}]Properties & Relations (1)
Dashing of any sort overrides the CapForm directive and effectively uses "Butt":
Graphics[{Dashing[{.1, .1}], 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[{.1, .1}, 0, "Round"], Thickness[.1], Line[{{0, 0}, {1, 1}}]}]Neat Examples (1)
Different line cap and join forms:
With[{points = {{0, 0.3}, {-0.5, 0}, {0.5, 0}, {0.3, 0.3}}}, Graphics[{Thickness[0.1], {Blue, CapForm["Square"], JoinForm["Miter"], Line[points]}, {Green, CapForm["Round"], JoinForm["Round"], Line[points]}, {Red, CapForm["Butt"], JoinForm["Bevel"], Line[points]}}, PlotRange -> 1]]See Also
Related Guides
History
Text
Wolfram Research (2008), CapForm, Wolfram Language function, https://reference.wolfram.com/language/ref/CapForm.html.
CMS
Wolfram Language. 2008. "CapForm." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/CapForm.html.
APA
Wolfram Language. (2008). CapForm. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/CapForm.html
BibTeX
@misc{reference.wolfram_2026_capform, author="Wolfram Research", title="{CapForm}", year="2008", howpublished="\url{https://reference.wolfram.com/language/ref/CapForm.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_capform, organization={Wolfram Research}, title={CapForm}, year={2008}, url={https://reference.wolfram.com/language/ref/CapForm.html}, note=[Accessed: 13-June-2026]}