Skip to content

Instantly share code, notes, and snippets.

@gadenbuie
Last active June 5, 2019 16:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gadenbuie/93e6a4629d9fd75b555de5e5a91e7cf2 to your computer and use it in GitHub Desktop.
Save gadenbuie/93e6a4629d9fd75b555de5e5a91e7cf2 to your computer and use it in GitHub Desktop.
ggplot2 linetype example
library(tidyverse)

tibble(y = 1:6, x = 0, xend = 1) %>%
  ggplot() +
  aes(x, y, xend = xend, yend = y, linetype = as.integer(y)) +
  geom_segment(size = 2) +
  theme_minimal(18) +
  scale_y_continuous(breaks = 1:6, trans = "reverse") +
  theme(
    plot.title = element_text("mono"),
    panel.grid = element_blank(), 
    axis.text.x = element_blank()
  ) +
  scale_linetype_identity() +
  labs(title = "linetype =", y = NULL, x = NULL)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment