View source: R/visualise_methylation.R
| visualise_methylation_colour_scale | R Documentation |
This function creates a scalebar showing the colouring scheme based on methylation
probability that is used in visualise_methylation(). Showing this is particularly
important when the colour range is clamped via low_clamp and high_clamp (e.g.
setting that all values below 100 are fully blue (#0000FF), all values above 200 are
fully red (#FF0000), and colour interpolation occurs only in the range 100-200, rather
than across the whole range 0-255). If clamping is off (default), then 0 is fully blue,
255 is fully read, and all values are linearly interpolated. NB: colours are configurable
but default to blue = low modification probability and red = high modification probability.
visualise_methylation_colour_scale(
low_colour = "blue",
high_colour = "red",
low_clamp = 0,
high_clamp = 255,
full_range = c(0, 255),
precision = 10^3,
background_colour = "white",
x_axis_title = NULL,
do_x_ticks = TRUE,
do_side_scale = FALSE,
side_scale_title = NULL,
outline_colour = "black",
outline_linewidth = 1
)
low_colour |
|
high_colour |
|
low_clamp |
|
high_clamp |
|
full_range |
|
precision |
|
background_colour |
|
x_axis_title |
|
do_x_ticks |
|
do_side_scale |
|
side_scale_title |
|
outline_colour |
|
outline_linewidth |
|
ggplot of the scalebar.
Unlike the other visualise_<> functions in this package, does not directly export a png. This is because there are no squares that need to be rendered at a precise aspect ratio in this function. It can just be saved normally with ggplot2::ggsave() with any sensible combination of height and width.
## Defaults match defaults of visualise_methylation()
visualise_methylation_colour_scale()
## Use clamping and change colours
visualise_methylation_colour_scale(
low_colour = "white",
high_colour = "black",
low_clamp = 0.3*255,
high_clamp = 0.7*255,
full_range = c(0, 255),
background_colour = "lightblue1",
x_axis_title = "Methylation probability"
)
## Lower precision = colour banding
visualise_methylation_colour_scale(
precision = 10,
do_x_ticks = FALSE
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.