Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save andrewheiss/b80e63b019054c4adf30af33fa47c159 to your computer and use it in GitHub Desktop.

Select an option

Save andrewheiss/b80e63b019054c4adf30af33fa47c159 to your computer and use it in GitHub Desktop.
library(tidyverse)
ggplot(data = tibble(x = 1, y = "A"), aes(x = x, y = y)) +
geom_pointrange(aes(xmin = 0.5, xmax = 1.5), color = "#1D6996") +
annotate(
geom = "text",
label = "geom_pointrange()",
x = 1,
y = 1.5,
hjust = 0.5,
family = "mono",
fontface = "bold",
color = "#1D6996",
size = 5
) +
annotate(
geom = "text",
label = "x",
x = 1,
y = 1.25,
hjust = 0.5,
family = "mono",
color = "#1D6996"
) +
annotate(
geom = "text",
label = "xmin",
x = 0.5,
y = 1.25,
hjust = 0.5,
family = "mono",
color = "#1D6996"
) +
annotate(
geom = "text",
label = "xmax",
x = 1.5,
y = 1.25,
family = "mono",
color = "#1D6996"
) +
annotate(
geom = "segment",
x = 1,
xend = 1,
y = 1.175,
yend = 1.075,
arrow = arrow(angle = 30, length = unit(0.25, "lines")),
color = "grey50",
linewidth = 0.4
) +
annotate(
geom = "segment",
x = 0.5,
xend = 0.5,
y = 1.175,
yend = 1.075,
arrow = arrow(angle = 30, length = unit(0.25, "lines")),
color = "grey50",
linewidth = 0.4
) +
annotate(
geom = "segment",
x = 1.5,
xend = 1.5,
y = 1.175,
yend = 1.075,
arrow = arrow(angle = 30, length = unit(0.25, "lines")),
color = "grey50",
linewidth = 0.4
) +
theme_void() +
ggview::canvas(width = 4.25, height = 1.5)
ggplot(data = tibble(x = 1, y = "A"), aes(x = x, y = y)) +
geom_segment(aes(x = 0.5, xend = 1.5), color = "#0F8554") +
geom_point(size = 2.6, color = "#E17C05") +
annotate(
geom = "text",
label = "geom_point()",
x = 1,
y = 1.5,
hjust = 0.5,
family = "mono",
fontface = "bold",
color = "#E17C05",
size = 5
) +
annotate(
geom = "text",
label = "x",
x = 1,
y = 1.25,
hjust = 0.5,
family = "mono",
color = "#E17C05"
) +
annotate(
geom = "text",
label = "geom_segment()",
x = 1,
y = 0.6,
hjust = 0.5,
family = "mono",
fontface = "bold",
color = "#0F8554",
size = 5
) +
annotate(
geom = "text",
label = "x",
x = 0.5,
y = 0.75,
hjust = 0.5,
family = "mono",
color = "#0F8554"
) +
annotate(
geom = "text",
label = "xend",
x = 1.5,
y = 0.75,
family = "mono",
color = "#0F8554"
) +
annotate(
geom = "segment",
x = 1,
xend = 1,
y = 1.175,
yend = 1.075,
arrow = arrow(angle = 30, length = unit(0.25, "lines")),
color = "grey50",
linewidth = 0.4
) +
annotate(
geom = "segment",
x = 0.5,
xend = 0.5,
y = 0.825,
yend = 0.925,
arrow = arrow(angle = 30, length = unit(0.25, "lines")),
color = "grey50",
linewidth = 0.4
) +
annotate(
geom = "segment",
x = 1.5,
xend = 1.5,
y = 0.825,
yend = 0.925,
arrow = arrow(angle = 30, length = unit(0.25, "lines")),
color = "grey50",
linewidth = 0.4
) +
theme_void() +
ggview::canvas(width = 4.25, height = 1.5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment