geom_th_axis: add the axis and the border add the axis and the border of an...

View source: R/geom_th_axis.R

geom_th_axisR Documentation

add the axis and the border add the axis and the border of an annotation plot

Description

add the axis and the border add the axis and the border of an annotation plot

Usage

geom_th_axis(
  name = NULL,
  th_data = NULL,
  axis_ticks_length = NULL,
  axis_color = "black",
  axis_label_color = "black",
  axis_label_size = 3,
  axis_label_nudge_x = 0,
  axis_label_nudge_y = 0,
  axis_direction = "h",
  axis_location = NULL,
  border_color = "grey",
  border_size = 0.5
)

Arguments

name

NULL or a name of heatmap (geom_th_heatmap).

th_data

a data frame. To draw a vertical axis, it requires columns axis_minX, axis_maxX, axisY and label, where axis_minX and axis_maxX decide the border limit on the x-dim. The axis is either on axis_minX for axis_location = "left" or axis_maxX for axis_location = "right". The axis ticks are decided by the axisY and the tick labels are given in label. Similarly, to draw a horizontal axis, it requires columns axisX, axis_minY, axis_maxY, and label.

axis_ticks_length

a number to decide the lenght of ticks.

axis_color

the color of the axis

axis_label_color

the color of axis labels

axis_label_size

the size of axis labels

axis_label_nudge_x

adjust the location of labels along x-axis

axis_label_nudge_y

adjust the location of labels along y-axis

axis_direction

either "h" for horizontal or "v" for vertical

axis_location

NULL. If axis_direction = "h", it should be "top" or "bottom"; otherwise, it should be "left" or "right".

border_color

the color of the rectangular border

border_size

the size of the border line

Author(s)

Ruizhu Huang

Examples

library(ggplot2)
df_v <- data.frame(axis_minX = rep(1, 10),
                   axis_maxX = rep(10, 10),
                   axisY = 1:10,
                   label = LETTERS[1:10])
ggplot() +
    geom_th_axis(th_data = df_v,
    axis_direction = "v",
    axis_location = "right")


df_h <- data.frame(axisX = 1:10,
                   axis_minY = rep(1, 10),
                   axis_maxY = rep(10, 10),
                   label = LETTERS[1:10])


ggplot() +
    geom_th_axis(th_data = df_h, axis_direction = "h")

fionarhuang/TreeHeatmap documentation built on Feb. 1, 2024, 7:30 a.m.