| annoRect | R Documentation | 
This function is used to add rect annotations in plot.
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 rect. Default(NULL).  | 
yPosition | 
 The y axis coordinate for the rect. Default(NULL).  | 
pCol | 
 The rect colors. Default(NULL).  | 
pFill | 
 The rect fill colors. Default(NULL).  | 
rectWidth | 
 The relative rect width. Default(1).  | 
lty | 
 The rect line type. Default(NULL).  | 
lwd | 
 The rect line width. Default(NULL).  | 
alpha | 
 The rect fill color alpha. Default(NULL).  | 
roundRect | 
 Whether add roundRect instead of rect. Default(FALSE).  | 
roundRadius | 
 The roundRect corner radius. Default(0.1).  | 
annoManual | 
 Whether annotate by yourself by supplying with x and y coordinates. Default(FALSE).  | 
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).  | 
textShift | 
 The text label shift size. Default(0).  | 
rotateRect | 
 Whether to rotate the rect annotation. Default(FALSE).  | 
normRectShift | 
 The "top" or "right" rotated rect shift. Default(0).  | 
rotatedRectShift | 
 The "botomn" or "left" rotated rect shift. Default(1).  | 
rectAngle | 
 Whether rotate the rect with specified degree. 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).  | 
continuesRect | 
 Whether add gradient-color-rect. Default(FALSE).  | 
border | 
 Whether add border for gradient-color-rect. Default(FALSE).  | 
conRectCol | 
 The colors for gradient-color-rect. Default(NULL).  | 
conRectColBin | 
 The colors numbers for gradient-color-rect. Default(10).  | 
interpolate | 
 Whether blur the colors. Default(TRUE).  | 
revColV | 
 Whether ajust the colors orders vertically. Default(FALSE).  | 
revColH | 
 Whether ajust the colors orders horizontally. Default(FALSE).  | 
Return a ggplot object.
Junjun Lao
# ===============================
# test function
# load data
data(p)
data(pgo)
data(pdotfc)
# default plot
annoRect(object = p,
         annoPos = 'top',
         xPosition = c(1:10))
# you can set y axis no expand
annoRect(object = p,
         annoPos = 'top',
         xPosition = c(1:10)) +
  ggplot2::scale_y_discrete(expand = c(0,0))
# adjust yPosition
annoRect(object = p,
         annoPos = 'top',
         xPosition = c(1:10),
         yPosition = c(11,11.5))
# another example annotation GO terms
annoRect(object = pgo,
        annoPos = 'right',
        yPosition = c(1:15),
        pCol = rep('transparent',15),
        pFill = rep(c('#F5F0BB','#C4DFAA','#90C8AC'),each = 5),
        xPosition = c(3,9.5),
        rectWidth = 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.