You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can control the line type by specifying a string with up to 8 hexadecimal values (i.e., from 0 to F). In this specification, the first value is the length of the first line segment, the second value is the length of the first space between segments, and so on. This allows you to specify your own line types using `scale_linetype_manual()`, or alternatively, by passing a custom function to the `palette` argument:
248
+
You can control the line type by specifying a string with up to 8 hexadecimal values (i.e., from 0 to F).
249
+
In this specification, the first value is the length of the first line segment, the second value is the length of the first space between segments, and so on.
250
+
This allows you to specify your own line types using `scale_linetype_manual()`, or alternatively, by passing a custom function to the `palette` argument:
249
251
250
252
```{r}
251
253
#| eval: false
@@ -264,14 +266,16 @@ linetypes <- function(n) {
264
266
return(types[seq_len(n)])
265
267
}
266
268
267
-
base + scale_linetype(palette = linetypes)
269
+
base + discrete_scale("linetype", palette = linetypes)
268
270
```
269
271
270
-
Note that the last four lines are blank, because the `linetypes()` function defined above returns `NA` when the number of categories exceeds 9. The `scale_linetype()` function contains a `na.value` argument used to specify what kind of line is plotted for these values. By default this produces a blank line, but you can override this by setting `na.value = "dotted"`:
272
+
Note that the last four lines are blank, because the `linetypes()` function defined above returns `NA` when the number of categories exceeds 9.
273
+
The `discrete_scale()` function contains a `na.value` argument used to specify what kind of line is plotted for these values.
274
+
By default this produces a blank line, but you can override this by setting `na.value = "dotted"`:
271
275
272
276
```{r}
273
277
#| eval: false
274
-
base + scale_linetype(palette = linetypes, na.value = "dotted")
278
+
base + discrete_scale("linetype", palette = linetypes)
275
279
```
276
280
277
281
Valid line types can be set using a human readable character string: `"blank"`, `"solid"`, `"dashed"`, `"dotted"`, `"dotdash"`, `"longdash"`, and `"twodash"` are all understood.
0 commit comments