Lines and Paths in TikZ
Master the fundamental drawing commands for lines, curves, and complex paths in TikZ.
Drawing Straight Lines
The basic line command connects two points with a straight line:
Use -- cycle to close a path back to its starting point.
Line Style Options
| Option | Effect |
|---|---|
thin | 0.4pt line width |
thick | 0.8pt line width |
very thick | 1.2pt line width |
ultra thick | 1.6pt line width |
line width=2pt | Custom line width |
dashed | Dashed line |
dotted | Dotted line |
dash dot | Alternating dash-dot |
dash pattern=on 2pt off 1pt | Custom dash pattern |
Curved Lines with Bezier Curves
Create smooth curves using .. controls .. for Bezier curves:
Smooth Curves Through Points
Use plot[smooth] to draw curves through multiple points:
Horizontal and Vertical Lines
Use -| and |- for right-angle paths:
Rounded Corners
Add rounded corners to any path:
Arc Paths
Draw circular arcs with the arc command:
Grid Lines
Draw grids for reference or backgrounds:
Line Caps and Joins
Control how line ends and corners are drawn:
Double Lines
Create double lines (useful for roads, walls, etc.):
Next Steps
Continue learning TikZ drawing techniques:
- Basic Shapes - Circles, rectangles, and polygons
- Arrows - Arrow tips and styles
- Colors and Styles - Color fills and custom styles
Lines and Paths in TikZ
Master the fundamental drawing commands for lines, curves, and complex paths in TikZ.
Drawing Straight Lines
The basic line command connects two points with a straight line:
Use -- cycle to close a path back to its starting point.
Line Style Options
| Option | Effect |
|---|---|
thin | 0.4pt line width |
thick | 0.8pt line width |
very thick | 1.2pt line width |
ultra thick | 1.6pt line width |
line width=2pt | Custom line width |
dashed | Dashed line |
dotted | Dotted line |
dash dot | Alternating dash-dot |
dash pattern=on 2pt off 1pt | Custom dash pattern |
Curved Lines with Bezier Curves
Create smooth curves using .. controls .. for Bezier curves:
Smooth Curves Through Points
Use plot[smooth] to draw curves through multiple points:
Horizontal and Vertical Lines
Use -| and |- for right-angle paths:
Rounded Corners
Add rounded corners to any path:
Arc Paths
Draw circular arcs with the arc command:
Grid Lines
Draw grids for reference or backgrounds:
Line Caps and Joins
Control how line ends and corners are drawn:
Double Lines
Create double lines (useful for roads, walls, etc.):
Next Steps
Continue learning TikZ drawing techniques:
- Basic Shapes - Circles, rectangles, and polygons
- Arrows - Arrow tips and styles
- Colors and Styles - Color fills and custom styles
