annoSegment: annoSegment

View source: R/annoSegment.R

annoSegmentR Documentation

annoSegment

Description

This function is used to add segment annotations in plot.

Arguments

object

Your ggplot list. Default(NULL).

relSideDist

The relative distance ratio to the y axis range. Default(0.1).

aesGroup

Whether use your group column to add rect annotation. Default("FALSE").

aesGroName

The mapping column name. Default(NULL).

annoPos

The position for the annotation to be added. Default("top").

xPosition

The x axis coordinate for the segment. Default(NULL).

yPosition

The y axis coordinate for the segment. Default(NULL).

pCol

The segment colors. Default(NULL).

segWidth

The relative segment width. Default(1).

lty

The segment line type. Default(NULL).

lwd

The segment line width. Default(NULL).

alpha

The segment color alpha. Default(NULL).

lineend

The segment line end. Default("square").

annoManual

Whether annotate by yourself by supplying with x and y coordinates. Default(FALSE).

mArrow

Whether add segment arrow. Default(FALSE).

addBranch

Whether add segment branch. Default(FALSE).

bArrow

Whether add branch arrow. Default(FALSE).

branDirection

The branch direction. Default(1).

branRelSegLen

The branch relative length to the segment. Default(0.3).

addText

Whether add text label on segment. Default(FALSE).

textCol

The text colors. Default(NULL).

textSize

The text size. Default(NULL).

fontfamily

The text fontfamily. Default(NULL).

fontface

The text fontface. Default(NULL).

textLabel

The text textLabel. Default(NULL).

textRot

The text angle. Default(NULL).

textHVjust

The text distance from the segment. Default(0.2).

hjust

The text hjust. Default(NULL).

vjust

The text vjust. Default(NULL).

myFacetGrou

Your facet group name to be added with annotation when object is a faceted object. Default(NULL).

aes_x

= NULL You should supply the plot X mapping name when annotate a facetd plot. Default(NULL).

aes_y

= NULL You should supply the plot Y mapping name when annotate a facetd plot. Default(NULL).

Value

Return a ggplot object.

Author(s)

Junjun Lao

Examples

# ===============================
# test function

# load data
data(p)
data(pdot)

# default plot
annoSegment(object = p,
           annoPos = 'top',
           xPosition = c(1:10))

# adjust rectWidth
annoSegment(object = p,
           annoPos = 'top',
           xPosition = c(1:10),
           segWidth = 0.8)

# add branch
annoSegment(object = pdot,
           annoPos = 'top',
           annoManual = TRUE,
           xPosition = list(c(1,3,4,7,9,11,12,15,17,19,20),
                            c(2,3,6,8,10,11,14,16,18,19,21)),
           yPosition = 9,
           segWidth = 0.8,
           pCol = rep('black',11),
           addBranch = TRUE,
           branDirection = -1,
           lwd = 3)

jjAnno documentation built on Aug. 23, 2022, 9:06 a.m.