GGplot - Line Geom

Ggplot Graphic Plot


line geom


Reference lines (sometimes called rules) are useful for annotating plots.

Line Configuration

lty <- c("blank", "solid", "dashed", "dotted", "dotdash", 
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_continuous(NULL, breaks = NULL)

Discover More
Ggplot Scale Coordinate System
GGplot - Scale (Data Transformation)

Scales control the mapping between data and aesthetics, and control the display of the matching guide (axis or legend) Ex: Linear scaling of x and y axes (scales) See: scale_continuous, scale_discrete,...
Ggplot Graphic Plot
Ggplot - Geom (geometric objects) - type of plot

Geom is a short for geometric objects that describe the type of plot produced. point for point (to create a scatterplot) line for a line ... The geom_... functions are shortcuts for a layer set...

Share this page:
Follow us:
Task Runner