Skip to content

Add a Footer to Each Cluster in a GC Chart ​

This function allows you to add a footer to all or specific clusters within a GC chart. You can specify titles, subtitles, and control the display and styling.

Usage ​

r
GC_clusterFooter(
  GC_chart,
  title = NULL,
  subtitle = NULL,
  show = TRUE,
  cluster = NULL,
  subtitleFont = list(),
  titleFont = list(),
  align = NULL,
  spacing = NULL,
  ...
)

Arguments ​

ArgumentDescription
GC_chartA GC chart object that the footers will be added to.
titleCharacter vector or NULL. The title to be displayed in the footer. Multiple titles can be provided for different clusters, and they will be recycled if there are more clusters than titles. Default is NULL.
subtitleCharacter vector or NULL. Subtitles to accompany the main titles. Default is NULL.
showLogical vector. Controls the visibility of each footer. Default is TRUE for all clusters.
clusterNumeric or character vector specifying which clusters should have footers added or updated. If NULL, all clusters will be updated. Default is NULL.
subtitleFontList, styling options for the subtitle.
titleFontList, styling options for the title.
alignCharacter vector. Horizontal alignment of the title and subtitle, "left", "center" or "right", recycled over the clusters. x moves them from this position. Default is NULL: the alignment of the theme, otherwise "left".
spacingNumeric vector. Pixels between the title and the subtitle, recycled over the clusters. Default is NULL: as set by the theme, otherwise 12.
...Additional arguments for further customization of the footers.

Value ​

A GC chart object with updated footer settings for each specified cluster.

Examples ​

r
genes_data <- data.frame(
  start = c(10, 90, 130, 170, 210),
  end = c(40, 120, 160, 200, 240),
  name = c('Gene 1', 'Gene 3', 'Gene 4', 'Gene 5', 'Gene 6'),
  group = c('A', 'B', 'B', 'A', 'C'),
  cluster = c(1, 1, 2, 2, 2)
)

# Add a simple footer with subtitle to all clusters
GC_chart(genes_data, cluster = "cluster", group = "group") %>%
  GC_clusterFooter(
    title = "Cluster Footer",
    subtitle = "Cluster subtitle"
  )
# Add styling to the title and subtitle
GC_chart(genes_data, cluster = "cluster", group = "group") %>%
  GC_clusterFooter(
    title = "This is a footer",
    subtitle = "Subtitle for the footer",
    show = TRUE,
    cluster = 1,
    x = 6,
    y = -20,
    align = "center", # left / right
    spacing = 12,
    titleFont = list(
      fontSize = "12px",
      fontWeight = "bold",
      fontFamily = "sans-serif",
      fill = "black",
      cursor = "default"
    ),
    subtitleFont = list(
      fill = "grey",
      fontSize = "10px",
      fontStyle = "normal",
      fontFamily = "sans-serif",
      cursor = "default"
    )
  )