Skip to content

Commit

Permalink
fix plotting
Browse files Browse the repository at this point in the history
  • Loading branch information
sbfnk committed Jan 16, 2024
1 parent efce724 commit 5d8e8b2
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions R/dist.R
Original file line number Diff line number Diff line change
Expand Up @@ -1432,18 +1432,19 @@ plot.dist_spec <- function(x, ...) {
value = numeric(), cdf = numeric(),
distribution = factor()
)
group_starts <- c(1L, cumsum(x$np_pmf_length) + 1L)
dist_sd <- sd_dist(x)
for (i in seq_along(x)) {
if (x[[i]]$distribution == "nonparametric") {
# Fixed distribution
pmf <- x$pmf[seq(group_starts[i], group_starts[i + 1L] - 1L)]
dist_name <- paste0("Fixed", " (ID: ", i, ")")
pmf <- x[[i]]$pmf
dist_name <- paste0("Nonparametric", " (ID: ", i, ")")

Check warning on line 1440 in R/dist.R

View check run for this annotation

Codecov / codecov/patch

R/dist.R#L1439-L1440

Added lines #L1439 - L1440 were not covered by tests
} else {
# Uncertain distribution
c_dist <- discretise(fix_dist(extract_single_dist(x, i)))
pmf <- c_dist[[1]]$pmf
dist_name <- paste0(
"Uncertain ", x[[i]]$distribution, " (ID: ", i, ")"
ifelse(is.na(dist_sd[i]), "Uncertain ", ""),
x[[i]]$distribution, " (ID: ", i, ")"
)
}
pmf_data <- rbind(
Expand Down

0 comments on commit 5d8e8b2

Please sign in to comment.