geom_segment_c: geom_segment_c

Description Usage Arguments Value Author(s) See Also Examples

View source: R/geom_segment_c.R

Description

geom_segment_c supports coloring segment with continuous colors

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
geom_segment_c(
  mapping = NULL,
  data = NULL,
  position = "identity",
  lineend = "butt",
  na.rm = FALSE,
  show.legend = NA,
  inherit.aes = TRUE,
  arrow = NULL,
  arrow.fill = NULL,
  ...
)

Arguments

mapping

aes mapping

data

data

position

position

lineend

lineend

na.rm

logical

show.legend

logical

inherit.aes

logical

arrow

specification for arrow heads, as created by arrow().

arrow.fill

fill color to usse for the arrow head (if closed). 'NULL' means use 'colour' aesthetic.

...

additional parameter

Value

add segment layer

Author(s)

Guangchuang Yu

See Also

geom_segment

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
set.seed(2019-06-28)
d = data.frame(x = rnorm(10),
              xend = rnorm(10),
              y = rnorm(10),
              yend = rnorm(10),
              v1 = rnorm(10),
              v2 = rnorm(10))
library(ggplot2)
library(gglayer)
ggplot(d) + geom_segment_c(aes(x = x, xend = xend, y=y, yend =yend, col0 = v1, col1 = v2)) +
   scale_color_viridis_c(name = "continuous colored lines") + 
   theme_minimal() + theme(legend.position=c(.2, .85)) + xlab(NULL) + ylab(NULL)

GuangchuangYu/gglayer documentation built on April 7, 2020, 9:35 a.m.