Skip to content

Commit 154fd7f

Browse files
Use linewidth in ggplot2-spec.Rmd (#4952)
1 parent afb75b6 commit 154fd7f

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

vignettes/ggplot2-specs.Rmd

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@ Line types can be specified with:
8989
The five standard dash-dot line types described above correspond to 44, 13,
9090
1343, 73, and 2262.
9191
92-
### Size
92+
### Linewidth
9393
94-
The `size` of a line is its width in mm.
94+
The `linewidth` of a line is its width in mm.
9595
9696
### Line end/join paramters
9797
@@ -102,16 +102,16 @@ The `size` of a line is its width in mm.
102102
df <- data.frame(x = 1:3, y = c(4, 1, 9))
103103
base <- ggplot(df, aes(x, y)) + xlim(0.5, 3.5) + ylim(0, 10)
104104
base +
105-
geom_path(size = 10) +
106-
geom_path(size = 1, colour = "red")
105+
geom_path(linewidth = 10) +
106+
geom_path(linewidth = 1, colour = "red")
107107
108108
base +
109-
geom_path(size = 10, lineend = "round") +
110-
geom_path(size = 1, colour = "red")
109+
geom_path(linewidth = 10, lineend = "round") +
110+
geom_path(linewidth = 1, colour = "red")
111111
112112
base +
113-
geom_path(size = 10, lineend = "square") +
114-
geom_path(size = 1, colour = "red")
113+
geom_path(linewidth = 10, lineend = "square") +
114+
geom_path(linewidth = 1, colour = "red")
115115
```
116116
117117
* The appearance of line joins is controlled by `linejoin` and can be one of
@@ -121,23 +121,23 @@ The `size` of a line is its width in mm.
121121
df <- data.frame(x = 1:3, y = c(9, 1, 9))
122122
base <- ggplot(df, aes(x, y)) + ylim(0, 10)
123123
base +
124-
geom_path(size = 10) +
125-
geom_path(size = 1, colour = "red")
124+
geom_path(linewidth = 10) +
125+
geom_path(linewidth = 1, colour = "red")
126126
127127
base +
128-
geom_path(size = 10, linejoin = "mitre") +
129-
geom_path(size = 1, colour = "red")
128+
geom_path(linewidth = 10, linejoin = "mitre") +
129+
geom_path(linewidth = 1, colour = "red")
130130
131131
base +
132-
geom_path(size = 10, linejoin = "bevel") +
133-
geom_path(size = 1, colour = "red")
132+
geom_path(linewidth = 10, linejoin = "bevel") +
133+
geom_path(linewidth = 1, colour = "red")
134134
```
135135
136136
Mitre joins are automatically converted to bevel joins whenever the angle is too small (which would create a very long bevel). This is controlled by the `linemitre` parameter which specifies the maximum ratio between the line width and the length of the mitre.
137137
138138
## Polygons
139139
140-
The border of the polygon is controlled by the `colour`, `linetype`, and `size` aesthetics as described above. The inside is controlled by `fill`.
140+
The border of the polygon is controlled by the `colour`, `linetype`, and `linewidth` aesthetics as described above. The inside is controlled by `fill`.
141141
142142
## Point
143143
@@ -199,7 +199,7 @@ Note that shapes 21-24 have both stroke `colour` and a `fill`. The size of the f
199199
```{r}
200200
sizes <- expand.grid(size = (0:3) * 2, stroke = (0:3) * 2)
201201
ggplot(sizes, aes(size, stroke, size = size, stroke = stroke)) +
202-
geom_abline(slope = -1, intercept = 6, colour = "white", size = 6) +
202+
geom_abline(slope = -1, intercept = 6, colour = "white", linewidth = 6) +
203203
geom_point(shape = 21, fill = "red") +
204204
scale_size_identity()
205205
```

0 commit comments

Comments
 (0)