Fix behavior of fill.by / y.max / same.y.lims parameters in RidgePlot#10424
Open
anashen wants to merge 8 commits into
Open
Fix behavior of fill.by / y.max / same.y.lims parameters in RidgePlot#10424anashen wants to merge 8 commits into
fill.by / y.max / same.y.lims parameters in RidgePlot#10424anashen wants to merge 8 commits into
Conversation
Previous behavior used ident as default despite documentation because of ExIPlot overrides
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses reported bugs in Seurat’s RidgePlot() parameter behavior by clarifying fill.by defaults, ensuring fill.by is propagated into the underlying plot builder, and improving shared axis-limit handling for ridge plots.
Changes:
- Updates
RidgePlot(fill.by=)to default toNULLand resolve the effective default based onstack. - Adds
fill.bysupport toSingleExIPlot()and threads it throughExIPlot(). - Attempts to compute and apply shared x-axis limits for ridge plots when
same.y.lims = TRUE(and incorporatey.max).
Reviewed changes
Copilot reviewed 1 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| R/visualization.R | Implements fill.by defaulting, propagates fill.by into SingleExIPlot, and adds ridge shared-limits computation/application logic. |
| man/SingleExIPlot.Rd | Documents new fill.by parameter for SingleExIPlot(). |
| man/RidgePlot.Rd | Updates RidgePlot() signature to reflect fill.by = NULL default. |
Files not reviewed (2)
- man/RidgePlot.Rd: Generated file
- man/SingleExIPlot.Rd: Generated file
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
9064
to
9066
| if (!is.data.frame(x = data) || ncol(x = data) != 1) { | ||
| stop("'SingleExIPlot requires a data frame with 1 column") | ||
| } |
Comment on lines
9159
to
9163
| jitter <- geom_jitter(width = 0, size = pt.size, alpha = alpha, show.legend = FALSE) | ||
| log.scale <- scale_x_log10() | ||
| axis.scale <- function(...) { | ||
| invisible(x = NULL) | ||
| log.scale <- scale_x_log10(expand = c(0, 0)) | ||
| axis.scale <- function(x.min, x.max) { | ||
| scale_x_continuous(expand = c(0, 0), limits = c(x.min, x.max)) | ||
| } |
Comment on lines
+564
to
565
| fill.by <- fill.by %||% if (stack) 'feature' else 'ident' | ||
| return(ExIPlot( |
anashen
force-pushed
the
fix/ridgeplot-param-behavior
branch
from
July 13, 2026 19:27
5c2c7f9 to
a3a4abd
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #10421 by @samuel-marsh.
This PR proposes the following:
fill.byparameter.ExIPlot, the default was actually "ident". Changing this to NULL, and picking a different default inside the function (ident if stack if FALSE, feature otherwise) helps to clarify this behavior.same.y.lims = TRUE. Add noise as necessary, following logic inMultiExIPlot, then apply this to all plots.fill.bytoSingleExIPlot. The default is "ident" so complete backwards compatibility is maintained (across calls to this function, for example in other visualization functions).Reprex
suppressPackageStartupMessages({ library(SeuratData) library(dplyr) library(patchwork) }) #> Warning: package 'dplyr' was built under R version 4.5.2 # must be on this branch devtools::load_all("~/seurat", quiet = TRUE) #> Warning: package 'sp' was built under R version 4.5.2 pbmc <- suppressWarnings(suppressMessages(UpdateSeuratObject(pbmc3k.final))) %>% subset(seurat_annotations %in% c("Platelet", "DC", "CD8 T", "CD14+ Mono")) # fill.by # note that fill.by = "feature" is not informative unless stack = TRUE RidgePlot(pbmc, features = "CD3E", fill.by = "ident") / RidgePlot(pbmc, features = "CD3E", fill.by = "feature") #> Picking joint bandwidth of 0.0808 #> Picking joint bandwidth of 0.0808Created on 2026-07-13 with reprex v2.1.1