Open machow opened 1 month ago
The ggplot aesthetic specification doc gives a handy example of customizing linetypes, using the following format:
library(ggplot2) lty <- c("11", "18", "1f", "81", "88", "8f", "f1", "f8", "ff") linetypes <- data.frame( y = seq_along(lty), lty = lty ) ggplot(linetypes, aes(0, y)) + geom_segment(aes(xend = 5, yend = y, linetype = lty)) + scale_linetype_identity() + geom_text(aes(label = lty), hjust = 0, nudge_y = 0.2) + scale_x_continuous(NULL, breaks = NULL) + scale_y_reverse(NULL, breaks = NULL)
It could be handy to allow for something similar.
ggplot2's linetype support matches base R's linetype specification (h/t tidyverse folks for the pointer):
This syntax allows each character in a string to specify width of "on" and "off" line parts. For example,
It uses hexadecimal format, so allows for..
It seems like the R syntax could be supported directly. But I wonder if using an explicit separator might help clean things up a bit?
Something like:
This way, it's clear what separates each piece, and people are constrained to a single character per part.
The ggplot aesthetic specification doc gives a handy example of customizing linetypes, using the following format:
It could be handy to allow for something similar.
Background on ggplot2 syntax
ggplot2's linetype support matches base R's linetype specification (h/t tidyverse folks for the pointer):
This syntax allows each character in a string to specify width of "on" and "off" line parts. For example,
It uses hexadecimal format, so allows for..
Proposed syntax
It seems like the R syntax could be supported directly. But I wonder if using an explicit separator might help clean things up a bit?
Something like:
This way, it's clear what separates each piece, and people are constrained to a single character per part.