-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Description
Problem:
When degPatterns produces plots with many facets here, the generated faceted ggplot becomes too crowded, in some cases making it hard or impossible to interpret the results.
Proposed Solution:
Use dynamic chunk creation for each plot. Find the number of gene clusters to be plotted for each contrast, and use this number to determine the plot dimensions used in the chunk options in each of the dynamic chunks created using the subchunkify function's arguments. This will ensure readability regardless of the number of clusters.
subchunkify:
# Use subchunkify to dynamically create chunks for variable number of clusters
subchunkify <- function(g, name, fig_height=10, fig_width=10) {
g_deparsed <- paste0(deparse(function() {g}), collapse = '')
sub_chunk <- paste0("`","``{r subchunk_", name,
", fig.height=", fig_height,
", fig.width=", fig_width,
" , echo=FALSE}",
"\n(", g_deparsed, ")()", "\n`", "``")
cat(knitr::knit(text = knitr::knit_expand(text = sub_chunk), quiet = TRUE))
can be inserted here
and called here like:
deg_plot_cluster <- degPlotCluster(
n2,
time=time,
min_genes=minc,
col=col
)
print(deg_plot_cluster)
# Get number of cluseters to plot, n
#fig_dimm <- 10 + ceiling(sqrt(n))/10
#subchunkify(print(deg_plot_cluster), paste0(name, '_finalclusters'),
#fig.height=fig.dimm, fig.width=fig.dimm)
This solution is incomplete and requires testing.
Metadata
Metadata
Assignees
Labels
No labels