Skip to content

Commit 7aa71c2

Browse files
committed
Fixed bug in which font.family would not apply correctly when label = TRUE in do_DimPlot and do_FeaturePlot.
1 parent fea9b84 commit 7aa71c2

File tree

5 files changed

+38
-2
lines changed

5 files changed

+38
-2
lines changed

NEWS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ The reason of these modification is to allow for a much clearer and concise outp
4242
- Added `split.by.combined` parameter and set its default value to `TRUE`. This allows to toggle on or off whether to display the combined view when `split.by` is used.
4343
- However, when `split.by`is used alongside `group.by`, it is now enforced to show the combined plot (`split.by.combined = TRUE`), to avoid bugs.
4444
- Added `legend.dot.border` parameter to select whether we want a black border around the legend dots or not.
45+
- Fixed a bug in which `font.family` would not be applied when `label = TRUE`. (#76)
4546

4647
## do_DotPlot()
4748
- Fixed a bug that caused sequential palettes to not be checked properly.
@@ -62,6 +63,7 @@ The reason of these modification is to allow for a much clearer and concise outp
6263
## do_FeaturePlot()
6364
- Fixed a bug in which legend titles would not show up as intended.
6465
- Enabled the use of several legend titles when multiple features are provided. The number of legend titles and features have to be equal.
66+
- Fixed a bug in which `font.family` would not be applied when `label = TRUE`. (#76)
6567

6668
## do_LigandReceptorPlot()
6769
- Added a new parameter `top_interactions_by_group` which when set to `TRUE` will report for each pair of `source` and `target`, as many interactions as stated in `top_interactions`.

R/do_DimPlot.R

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1022,7 +1022,21 @@ do_DimPlot <- function(sample,
10221022
panel.background = ggplot2::element_rect(fill = "white", color = "white"),
10231023
legend.background = ggplot2::element_rect(fill = "white", color = "white"))
10241024
}
1025-
1025+
1026+
# Add font.family to geom_text and geom_label.
1027+
if (length(p$patches$plots) > 0){
1028+
num.plots <- length(p$patches$plots)
1029+
} else {
1030+
num.plots <- 1
1031+
}
1032+
for (plot.use in seq(1, num.plots)){
1033+
for (layer.use in seq(1, length(p[[plot.use]]$layers))){
1034+
if (sum(stringr::str_detect(class(p[[plot.use]]$layers[[layer.use]]$geom), "GeomText|GeomLabel"))){
1035+
p[[plot.use]]$layers[[layer.use]]$aes_params$family <- font.family
1036+
}
1037+
}
1038+
}
1039+
10261040

10271041
# Add plot title to the plots.
10281042
if (!is.null(plot.title)){

R/do_DotPlot.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ do_DotPlot <- function(sample,
177177
crayon_key("0"),
178178
crayon_body(".")))
179179

180-
assertthat::assert_that(slot == "scale.data",
180+
assertthat::assert_that(slot == "data",
181181
msg = paste0(add_cross(), crayon_body("Please set "),
182182
crayon_key("slot"),
183183
crayon_body(" to "),

R/do_FeaturePlot.R

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1021,6 +1021,23 @@ do_FeaturePlot <- function(sample,
10211021
plot.background = ggplot2::element_rect(fill = "white", color = "white"),
10221022
panel.background = ggplot2::element_rect(fill = "white", color = "white"),
10231023
legend.background = ggplot2::element_rect(fill = "white", color = "white"))
1024+
1025+
1026+
# Add font.family to geom_text and geom_label.
1027+
if (length(p$patches$plots) > 0){
1028+
num.plots <- length(p$patches$plots)
1029+
} else {
1030+
num.plots <- 1
1031+
}
1032+
for (plot.use in seq(1, num.plots)){
1033+
for (layer.use in seq(1, length(p[[plot.use]]$layers))){
1034+
if (sum(stringr::str_detect(class(p[[plot.use]]$layers[[layer.use]]$geom), "GeomText|GeomLabel"))){
1035+
p[[plot.use]]$layers[[layer.use]]$aes_params$family <- font.family
1036+
}
1037+
}
1038+
}
1039+
1040+
10241041
if (is.null(split.by) & legend.position != "none"){
10251042
counter <- 0
10261043
for (feature in features){

man/do_VolcanoPlot.Rd

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

0 commit comments

Comments
 (0)