R/plot_segment_density.R
plot_segment_density.RdThis function works for a clustering result, whatever is the adopted model. It returns a list of plots for each one of the input segments. Each plot shows the data, plus the fit density per cluster. It can be used to assess the quality of the data and fits.
plot_segment_density(
x,
segments_ids = get_segment_ids(x),
sum_denominator = TRUE
)Input object with clusters.
Vector of segment ids in the CONGAS format (e.g, "chr12:40515401:133219374").
By default all are used via function get_segment_ids.
A list of ggplot objects.
x = Rcongas::congas_example
# Plot the first segment
plot_segment_density(x, segments_ids = get_segment_ids(x)[1])
#> Warning: `guides(<scale> = FALSE)` is deprecated. Please use `guides(<scale> = "none")` instead.
#> $`chr1:1:12600000`
#>
# Plot the first one that is highlighted
plot_segment_density(x, segments_ids = get_segment_ids(x, highlight = TRUE)[1])
#> Warning: `guides(<scale> = FALSE)` is deprecated. Please use `guides(<scale> = "none")` instead.
#> $`chr14:93300001:105450000`
#>
# Plot the top 4 highlighted, in 2x2 format, specifying alpha value
what_to_plot = get_segment_ids(x, highlight = TRUE, alpha = 0.05)[1:4]
ggpubr::ggarrange(
plotlist = plot_segment_density(x, segments_ids = what_to_plot),
nrow = 2,
ncol = 2
)
#> Warning: `guides(<scale> = FALSE)` is deprecated. Please use `guides(<scale> = "none")` instead.
#> Warning: `guides(<scale> = FALSE)` is deprecated. Please use `guides(<scale> = "none")` instead.
#> Warning: `guides(<scale> = FALSE)` is deprecated. Please use `guides(<scale> = "none")` instead.
#> Warning: `guides(<scale> = FALSE)` is deprecated. Please use `guides(<scale> = "none")` instead.