Skip to content

Update Scale Bar of a GC Chart Cluster ​

Modify the scale bar settings for specified clusters within a GC chart.

Usage ​

r
GC_scaleBar(
  GC_chart,
  show = TRUE,
  cluster = NULL,
  scaleBarLineStyle = list(),
  scaleBarTickStyle = list(),
  labelStyle = list(),
  ...
)

Arguments ​

ArgumentDescription
GC_chartA GC chart object.
showLogical. Whether to show the scale bar.
clusterNumeric or character vector. Clusters in the GC chart to update.
scaleBarLineStyleList of style options for the scale bar line.
scaleBarTickStyleList of style options for the scale bar ticks.
labelStyleList of style options for the scale bar label.
...Additional arguments for scale bar settings.

Value ​

Updated GC chart with new scale bar settings.

Examples ​

r
genes_data <- data.frame(
 start = c(1000, 9000, 13000, 17000, 21000),
 end = c(4000, 12000, 16000, 20000, 24000),
 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)
)

# Set scale bar for individual clusters
GC_chart(genes_data, cluster ="cluster", group = "group") %>%
GC_scaleBar(cluster = 1, title = "1 kb", scaleBarUnit = 1000) %>%
GC_scaleBar(cluster = 2, title = "2 kb", scaleBarUnit = 2000)

# Style scale bar
GC_chart(genes_data, cluster ="cluster", group = "group", height = "400px") %>%
  GC_scaleBar(
    title = "1kb",
    scaleBarUnit = 1000,
    cluster = NULL,
    x = 0,
    y = 50,
    labelStyle = list(
      labelPosition =  "left",
      fontSize = "10px",
      fontFamily = "sans-serif",
      fill = "red", # Text color
      cursor = "default"
      # Any other CSS style for the label
    ),
    textPadding = -2,
    scaleBarLineStyle = list(
      stroke = "black",
      strokeWidth = 1
      # Any other CSS style for the line
    ),
    scaleBarTickStyle = list(
      stroke = "black",
      strokeWidth = 1
      # Any other CSS style for the tick
    )
  )