Skip to content

Update cluster Title of a GC Chart Cluster ​

Modify the cluster title and subtitle of specified clusters within a GC chart and adjust the display settings.

Usage ​

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

Arguments ​

ArgumentDescription
GC_chartA GC chart object.
titleCharacter vector. Titles to set for the clusters.
subtitleCharacter vector. Subtitles to set for the clusters.
subtitleFontList. Settings for the subtitle font.
titleFontList. Settings for the title font.
showLogical. Whether to display the title. Default is TRUE.
heightCharacter. Height for the title (e.g., "40px").
clusterNumeric or character vector. Clusters in the GC chart to update.
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 "center".
spacingNumeric vector. Pixels between the title and the subtitle, recycled over the clusters. Default is NULL: as set by the theme, otherwise 20.
...Additional customization arguments for title and subtitle.

Value ​

Updated GC chart with new title settings.

Examples ​

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

# Basic usage
GC_chart(genes_data, cluster ="cluster", group = "group", height = "400px") %>%
GC_labels("name") %>%
GC_clusterTitle(
  title = "Cluster 1 Data",
  subtitle = "Detailed View",
  show = TRUE,
  cluster = 1
)

# Customizing title style
GC_chart(genes_data, cluster = "cluster", group = "group", height = "400px") %>%
  GC_labels("name") %>%
  GC_clusterTitle(
    title = "Cluster 1 Data",
    subtitle = "Detailed View",
    show = TRUE,
    cluster = 1,
    x = 0,
    y = 5,
    align = "center",
    spacing = 20,
    titleFont = list(
      fontSize = "16px",
      fontStyle = "normal",
      fontWeight = "bold",
      textDecoration = "normal",
      fontFamily = "sans-serif",
      cursor = "default",
      fill = "black"
      # Any other CSS styles
    ),
    subtitleFont = list(
      fontSize = "14px",
      fontStyle = "normal",
      fontWeight = "bold",
      textDecoration = "normal",
      fontFamily = "sans-serif",
      cursor = "default",
      fill = "black"
      # Any other CSS styles
    )
  )