Calculates the pixel height a plot needs based on the number of
tracks (e.g., modalities, genes) in the data. Used by the Shiny app
to set dynamic height in renderPlot().
Arguments
- obj
An
AlphaVarSetobject. Anything else returnsbase_heightunchanged, so a not-yet-loaded Shiny input is safe.- base_height
Integer. Minimum height in pixels (default 450).
- per_element
Integer. Additional pixels per track/element (default 120).
- count_col
Character. Column to count unique elements from. Default
"output_type".
Examples
example_file <- system.file(
"extdata", "bcl11a_rs1427407_example.csv", package = "AlphaVaR"
)
obj <- av_import_csv(example_file)
#> Reading bcl11a_rs1427407_example.csv ...
# 11 AlphaGenome modalities in this export, so a facet-per-modality panel
# needs far more vertical room than the 450 px floor.
.av_estimate_height(obj)
#> [1] 1770
# The same call keyed on the two scored alleles instead.
.av_estimate_height(obj, base_height = 200L, per_element = 150L,
count_col = "variant_id")
#> [1] 500