Update Scale of a GC Chart Cluster
Modify the scale settings for specified clusters within a GC chart.
Usage
r
GC_scale(
GC_chart,
cluster = NULL,
start = NULL,
end = NULL,
padding = NULL,
hidden = FALSE,
breaks = list(),
tickValues = NULL,
reverse = FALSE,
axis_position = NULL,
axis_type = "position",
y = NULL,
scale_breaks = FALSE,
scale_break_threshold = 20,
scale_break_padding = 1,
ticksCount = NULL,
ticksFormat = NULL,
tickStyle = list(),
textStyle = list(),
lineStyle = list(),
...
)Arguments
| Argument | Description |
|---|---|
GC_chart | A GC chart object. |
cluster | Numeric or character vector specifying clusters in the GC chart to update. |
start | Numeric vector indicating the starting point for the scale. Default is NULL. |
end | Numeric vector indicating the end point for the scale. Default is NULL. |
padding | Numeric value or percentage string indicating the padding on either side of the scale. The value can be a number or a string in the format of '2%'. Default is NULL: as set by the theme, otherwise 2. |
hidden | Logical flag indicating whether the axis is hidden. Default is FALSE. |
breaks | The scale breaks: stretches of the scale that are left out, with break marks on the line. Either a list of breaks for all selected clusters, e.g. list(list(start = 5486, end = 9336)), or a data frame with start and end columns and, for breaks per cluster, a cluster column. Positions are those of the data, also with axis_type = "range". Default is an empty list (). |
tickValues | Numeric vector or NULL, custom tick values to be used at the top of the cluster. If NULL, the default tick values are used. |
reverse | Logical flag indicating whether to reverse the scale for the corresponding cluster. Default is FALSE. |
axis_position | Character string indicating the type of the axis ('top' or bottom'). Default is NULL: as set by the theme, otherwise 'bottom'. |
axis_type | Character string indicating the type of the axis ('position' or 'range'). Default is 'position'. |
y | Numeric value from 1 to 100 indicating the y-position of the x-axis. Default is NULL. |
scale_breaks | Logical flag indicating if scale breaks should be employed. Default is FALSE. |
scale_break_threshold | Numeric value indicating the threshold percentage for determining scale breaks. Default is 20. |
scale_break_padding | The room left on either side of a scale break: a number, as a percentage of the region shown (without its breaks), or a string in base pairs, e.g. "500bp", for the same room around every break. Default is 1. |
ticksCount | Numeric value indicating the number of ticks on the scale. Default is NULL: as set by the theme, otherwise 10. |
ticksFormat | Format for tick labels; depends on axis_type, defaulting to ",.0f" for 'position' or ".2s" for 'range' when NULL. |
tickStyle | List specifying the style for the ticks. |
textStyle | List specifying the style for the tick text. |
lineStyle | List specifying the style for the axis line. |
... | Additional arguments for scale settings. |
Value
Updated GC chart with new scale settings.
Examples
r
genes_data <- data.frame(
start = c(100, 1000, 2000),
end = c(150, 1500, 2500),
name = c('Gene 4', 'Gene 5', 'Gene 6'),
group = c('B', 'A', 'C'),
cluster = c(2, 2, 2)
)
#Example usage with all custom options
GC_chart(genes_data, cluster = "cluster", group = "group", height = "200px") %>%
GC_scale(
start = 1,
end = 2600,
padding = 2,
hidden = FALSE,
reverse = FALSE,
axis_position = "bottom",
# breaks = list(
# list(start = 160, end = 900),
# list(start = 1600, end = 1900)
# ),
# tickValues = c(1, 2600),
scale_breaks = TRUE,
scale_break_threshold = 20,
scale_break_padding = 1,
ticksCount = 10,
ticksFormat = ",.0f",
y = NULL,
tickStyle =
list(
stroke = "grey",
strokeWidth = 1,
lineLength = 6
# Any other CSS styles
),
textStyle =
list(
fill = "black",
fontSize = "10px",
fontFamily = "Arial",
cursor = "default"
# Any other CSS styles
),
lineStyle = list(
stroke = "grey",
strokeWidth = 1
# Any other CSS styles
)
) %>%
GC_legend(FALSE)