Skip to content

Commit 3d32dc8

Browse files
committed
Fixed color scales not displaying correctly when symmetry_center was used.
1 parent c03dffd commit 3d32dc8

File tree

7 files changed

+5
-54
lines changed

7 files changed

+5
-54
lines changed

NEWS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
- Whenever a categorical color scale is used, now you can set `colorblind = TRUE`, and it will pull from a collection of different published colorblind-safe palettes. If the length of the classes in the categorical variable matches the length of one of the palettes, that palettes is used. If not, a pool will be selected, with a total maximum of 85 categories allowed. If `colors.use` is used, `colorblind` has no effect (thus, check if your palette is colorblind-safe with `do_ColorBlindCheck()`). For continuous variables, `YlGnBu` is used. For divergent variables, `RdBu` is used. Both `YlGnBu` and `RdBu` are colorblind-safe. Since they are set as default, there is no need for `colorblind` parameter in the functions that only plot continuous/divergent variables.
1212
- Added support to show the values as text in most heatmap-based functions. This is achieved by using `values.show = TRUE`.
1313
- Aesthetics of the text labels can be tuned with `values.threshold`, `values.size` and `values.round`.
14+
- Fixed an issue where `symmetry_center` would not work as intended. Now it correctly displays the color scale with the provided value in the center.
15+
1416
## Added functions
1517
- `do_WafflePlot()`: This function displays proportions as a pictogram grid of 10x10 tiles. It helps to visually see at a glance the proportions of your data. This fails to correctly convey decimal proportions and completely ignores heavily under-represented classes in your dataset.
1618
- `do_RankedExpressionHeatmap()` to plot expression values as a heatmap along a dimensional reduction component.

R/do_ChordDiagramPlot.R

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
#' }
4343
#' @param padding_labels \strong{\code{\link[base]{numeric}}} | Number of extra padding (white spaces) of the labels so that they do not overlap with the scales.
4444
#' @param colors.from,colors.to \strong{\code{\link[SCpubr]{named_vector}}} | Named vector of colors corresponding to the unique values of "from" and "to".
45-
#' @param ... For internal use only.
4645
#'
4746
#' @return A circlize plot.
4847
#' @export
@@ -116,8 +115,6 @@ do_ChordDiagramPlot <- function(sample = NULL,
116115
check_parameters(parameter = alpha.highlight, parameter_name = "alpha.highlight")
117116
circlize::circos.clear()
118117

119-
extra_params <- list(...)
120-
121118
assertthat::assert_that(!is.null(sample),
122119
msg = paste0(add_cross(), crayon_body("Please provide a "),
123120
crayon_key("Seurat object"),

R/do_FeaturePlot.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,6 @@ do_FeaturePlot <- function(sample,
371371
enforce_symmetry = enforce_symmetry)
372372
}
373373

374-
375374
# Generate base layer.
376375
if (isTRUE(plot_cell_borders)){
377376
out <- compute_umap_layer(sample = sample,
@@ -465,6 +464,7 @@ do_FeaturePlot <- function(sample,
465464
enforce_symmetry = enforce_symmetry,
466465
center_on_value = if(symmetry.type == "absolute"){FALSE} else {TRUE},
467466
value_center = symmetry.center)
467+
468468
p <- add_scale(p = p,
469469
function_use = ggplot2::scale_color_gradientn(colors = colors.gradient,
470470
na.value = na.value,

R/utils.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1268,8 +1268,8 @@ compute_scales <- function(sample,
12681268
} else {
12691269
low_end <- value_center - limits[1]
12701270
high_end <- limits[2] - value_center
1271-
value.use <- max(c(low_end, high_end))
1272-
limits <- c(1 - value.use, 1 + value.use)
1271+
value.use <- max(c(abs(low_end), abs(high_end)))
1272+
limits <- c(value_center - value.use, value_center + value.use)
12731273
}
12741274

12751275
}

man/do_ChordDiagramPlot.Rd

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/do_RidgePlot.Rd

Lines changed: 0 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/examples/examples_do_RidgePlot.R

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -20,29 +20,6 @@
2020
viridis.direction = 1)
2121
p
2222

23-
# Draw quantiles of the distribution.
24-
p <- SCpubr::do_RidgePlot(sample = sample,
25-
feature = "nFeature_RNA",
26-
continuous_scale = TRUE,
27-
compute_quantiles = TRUE,
28-
compute_custom_quantiles = TRUE)
29-
p
30-
31-
# Draw probability tails.
32-
p <- SCpubr::do_RidgePlot(sample = sample,
33-
feature = "nFeature_RNA",
34-
continuous_scale = TRUE,
35-
compute_quantiles = TRUE,
36-
compute_distribution_tails = TRUE)
37-
p
38-
39-
# Draw probability tails.
40-
p <- SCpubr::do_RidgePlot(sample = sample,
41-
feature = "nFeature_RNA",
42-
continuous_scale = TRUE,
43-
compute_quantiles = TRUE,
44-
color_by_probabilities = TRUE)
45-
p
4623
} else if (base::isFALSE(value)){
4724
message("This function can not be used without its suggested packages.")
4825
message("Check out which ones are needed using `SCpubr::state_dependencies()`.")

0 commit comments

Comments
 (0)