# Line joints and caps Every Line2D joint, cap and gradient side by side. ```{raw} html ▶ Run in browser ``` **Tags:** `2d` A `Line2D` is more than a run of segments. Where it bends it leaves a notch, and `joint_mode` decides what fills it; where it ends it stops flat, and `begin_cap_mode` / `end_cap_mode` decide whether it rounds off; and `gradient` colours it along its own length instead of flat. ## How it works Four rows, each the same zigzag drawn with a different setting so the difference is visible rather than described: 1. `joint_mode` is `"sharp"` (a miter), `"bevel"` (a flat corner) or `"round"` (an arc). A miter that would shoot a spike off a near-reversal falls back to a bevel on its own. 2. `begin_cap_mode` and `end_cap_mode` are `"none"` or `"round"`, and each end is set independently. 3. `gradient` is a list of `(t, colour)` stops. `t` runs from 0 at the first point to 1 at the last, measured along the line, and the gradient replaces `colour` rather than tinting it. 4. A `width` of 1.0 or less is a hairline: it rides the one-pixel line pipeline whatever the camera is doing, so it has no width for a joint or a cap to fill and neither is drawn. The alpha on the top row is deliberately low: a joint fills the outside of a bend only, so a translucent line does not darken along its own corners. ## Source ```{literalinclude} ../../examples/features/2d/line_joints_and_caps.py :language: python :linenos: ```