跳到正文
0.16.6 文档

本页完整说明已译为现代汉语;函数、参数、代码和原始数据标识保留原样。 使用教程

全站目录 · 按任务查找

需要 qaccver、saccver、qpos、spos。位置使用与序列轨道相同的基因组坐标。曲线从 query 指向 subject,因此 arrow() 提供的箭头默认指向 subject。

用法

代码
geom_link_line(
  mapping = NULL,
  data = NULL,
  link_type = c("curve", "straight"),
  link_gap = NULL,
  link_ctrl_point = NULL,
  link_avoid = c("none", "smooth", "uniform"),
  link_branch = c("none", "query", "subject"),
  link_branch_fraction = 0.15,
  arrow = NULL,
  colour = "#59636D",
  alpha = 0.6,
  linewidth = 0.4,
  linetype = 1,
  position = "identity",
  show.legend = NA,
  inherit.aes = FALSE,
  ...
)

参数

mapping, data

标准 ggplot2 映射及图层数据,支持数据函数。

连接形状:默认 "curve" 曲线,或 "straight" 直线。

显式端点间距。默认 link_avoid = "none" 时,NULL 使用固定间距 0.035;将 link_avoid 设为 "smooth" 或 "uniform" 可启用考虑图形实体的间距。

贝塞尔控制点:两个数、四个数或逐输入行列表。

避障方式:"none"(默认)、"smooth" 或 "uniform";显式间距优先。

共享相同 query 或 subject 端点:"none"、"query"、"subject"。

共享段相对最短成员的长度比例,范围 (0, 0.5]。

arrow

grid 箭头定义或 NULL。

colour, alpha, linewidth, linetype

固定样式;映射使用 link_* aesthetic。显式固定值优先于对应映射。要保留映射请省略固定参数;inherit.aes = TRUE 时也包括继承的映射。

position, show.legend, inherit.aes

标准 ggplot2 图层参数。

...

其他路径参数。

返回值

一个 ggplot2 图层。

示例

代码
library(dplyr)
data(seq_data_example)
seqs <- seq_data_example |>
  select(accver, length)
data(ribbon_data_example)
links <- ribbon_data_example |>
  select(qaccver, saccver, qstart, qend, sstart, send, pident, length)
points <- links |>
  transmute(qaccver, saccver,
    qpos = floor((qstart + qend) / 2),
    spos = floor((sstart + send) / 2)
  )
ggchord(seq_data = seqs) +
  geom_seq() +
  geom_link_line(data = points)