Add Title to a GC_chart
Modify the cluster title and subtitle of specified clusters within a GC chart and adjust the display settings.
Usage
r
GC_title(
GC_chart,
title = NULL,
subtitle = NULL,
style = list(),
subtitleFont = list(),
titleFont = list(),
show = TRUE,
height = NULL,
align = NULL,
spacing = NULL,
...
)Arguments
| Argument | Description |
|---|---|
GC_chart | A GC chart object. |
title | Character vector. Titles to set for the clusters. |
subtitle | Character vector. Subtitles to set for the clusters. |
style | A list of CSS styles to be applied to the chart container. Each element of the list should be a valid CSS property-value pair. For example, list(backgroundColor = "white", border = "2px solid black"). Default is an empty list. |
subtitleFont | List. Settings for the subtitle font. |
titleFont | List. Settings for the title font. |
show | Logical. Whether to display the title. Default is TRUE. |
height | Character. Height for the title (e.g., "50px"). Default is NULL: the height of the theme, otherwise 50 pixels with a subtitle and 40 without. |
align | Character. Horizontal alignment of the title and subtitle, "left", "center" or "right". x moves them from this position. Default is NULL: the alignment of the theme, otherwise "center". |
spacing | Numeric. Pixels between the title and the subtitle. 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_title(
title = "Cluster 1 Data",
subtitle = "Detailed View",
show = TRUE
)
# Customizing title style
GC_chart(genes_data, cluster = "cluster", group = "group", height = "500px") %>%
GC_labels("name") %>%
GC_title(
title = "Cluster 1 Data",
subtitle = "Detailed View",
show = TRUE,
height = "50px",
cluster = 1,
x = 0,
y = 25, # height / 2
align = "center",
spacing = 20,
style = list(
backgroundColor = "#0000"
# Any other CSS styles
),
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
)
)