Skip to content

Commit eaed5ad

Browse files
committed
Fixed #172
1 parent ffb4dc4 commit eaed5ad

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

NEWS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* [#181](https://github.com/boxuancui/DataExplorer/issues/181): Added `by` argument to `plot_histogram` and `plot_density` to break down distributions by a discrete or continuous feature.
44

55
## Bug Fixes
6+
* [#172](https://github.com/boxuancui/DataExplorer/issues/172): Fixed `plot_qq(..., by = ...)` error "Faceting variables must have at least one value".
67
* [#185](https://github.com/boxuancui/DataExplorer/issues/185): Fixed warnings from deprecated `aes_string`.
78

89
# DataExplorer 0.8.4

R/plot_qq.R

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,10 @@ plot_qq <- function(data, by = NULL, sampled_rows = nrow(data),
5858
dt2 <- suppressWarnings(melt.data.table(data.table(continuous), measure.vars = names(continuous), variable.factor = FALSE))
5959
}
6060
feature_names <- unique(dt2[["variable"]])
61-
## Calculate number of pages
62-
layout <- .getPageLayout(nrow, ncol, ncol(continuous))
61+
## Calculate number of pages (when by is continuous it is removed from plot, so nplots is one less)
62+
nplots <- ncol(continuous)
63+
if (!is.null(by) && by %in% names(continuous)) nplots <- nplots - 1L
64+
layout <- .getPageLayout(nrow, ncol, nplots)
6365
## Create list of ggplot objects
6466
plot_list <- .lapply(
6567
parallel = parallel,

0 commit comments

Comments
 (0)