I want to manually specify the linetypes for a fixed ordering of factors (so changing the underlying factor ordering is not an option).
library(ggplot2)
df = data.frame(x = rep(1:10, 3),
y = c(runif(10), runif(10), runif(10)),
z = c(rep("a", 10), rep("b", 10), rep("c", 10)))
ggplot(df, aes(x, y, linetype = z)) + geom_line()
ggplot(df, aes(x, y, linetype = z)) +
geom_line() +
scale_linetype_manual(values = c("solid", "dotted", "dashed"))
These are not the same.
Why not?
How do I make them the same?
R version 4.1.2 (2021-11-01)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Monterey 12.4
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
other attached packages:
[1] ggplot2_3.3.5


