[r] Add examples for single cell plots and trackplots#233
Conversation
Co-authored-by: Ben Parks <bnprks@users.noreply.github.com>
delete intermediates when exiting clean up docs wording
…ecessary parameterization + fix example styling
| #' @return By default, returns a ggplot2 object with all the requested features plotted | ||
| #' in a grid. If `return_data` or `return_plot_list` is called, the return value will | ||
| #' match that argument. | ||
| #' @examples |
There was a problem hiding this comment.
I'm rendering two plots, once by just the clusters, and one with the features. Not really understanding why this is erroring out, when running this code in console runs completely fine.
| #' mat_norm <- log1p(multiply_cols(mat, 1/colSums(mat)) * 10000) %>% write_matrix_memory(compress = FALSE) | ||
| #' ## Get variable genes | ||
| #' stats <- matrix_stats(mat, row_stats = "variance") | ||
| #' variable_genes <- order(stats$row_stats["variance",], decreasing=TRUE) %>% |
There was a problem hiding this comment.
Not really liking doing all of this setup where I'm doing PCA and clustering. I think this can be vastly shortened when we have the #189 feature added in + a PCA DimReduction. But should we just do it with a fake matrix created by manually concatting multiple different distributions?
| #' mat <- get_demo_mat() | ||
| #' cell_types <- paste("Group", rep(1:3, length.out = length(colnames(mat)))) | ||
| #' | ||
| #' ## Plot dot |
There was a problem hiding this comment.
Same issue with the y label where it's not being rendered properly. I think it is again with the argument_name() navigating up the call stack.
| #' @param label_size size for transcript labels in units of mm | ||
| #' @return Plot of gene locations | ||
| #' @seealso `trackplot_combine()`, `trackplot_coverage()`, `trackplot_loop()`, `trackplot_scalebar()` | ||
| #' @examples |
There was a problem hiding this comment.
Side thought but maybe it would be good to split into to y-axis levels even when there isn't direct intersection of two genes. It is a little bit hard to distinguish the genes in this example.
| #' the text label, y-axis, and plot body. The relative height of each row is given | ||
| #' by heights. A shared title and x-axis are put at the top. | ||
| #' @seealso `trackplot_coverage()`, `trackplot_gene()`, `trackplot_loop()`, `trackplot_scalebar()` | ||
| #' @examples |
There was a problem hiding this comment.
Should we expand the trackplot_combine() section, or is this good for now?
| #' @param show_strand If TRUE, show strand direction as arrows | ||
| #' @return Plot of genomic loci if return_data is FALSE, otherwise returns the data frame used to generate the plot | ||
| #' @seealso `trackplot_combine()`, `trackplot_coverage()`, `trackplot_loop()`, `trackplot_scalebar()`, `trackplot_gene()` | ||
| #' @examples |
There was a problem hiding this comment.
The peaks here don't look great, should I use a different example?
…rackplot_loop()`
39611d8 to
dbbb491
Compare
This PR provides function examples for most of the functions in the
Single Cell plotsandGenomic track plotssection.This PR also provides a function (
render_plot_from_storage()) that allows for resizing plots in an example, as pkgdown does not natively provide configuration on that end.Missing functions include the following:
plot_tf_footprint()set_trackplot_label()set_trackplot_height()andget_trackplot_height().trackplot_combine()function. This would turn into an entire mini-vignette with customizing thetrackplot_combine()plot. Should this be the goal?There are some various thoughts, and issues with the plots, that I will note directly in code. However, there is a large issue that likely comes from
argument_name()that causes the plots in pkgdown to be different than what is rendered in console. I tried with and without rendering to storage, but the issue still persists.