Skip to content

Commit

Permalink
Fixes #1128 demography range plots use appropriate number of bins
Browse files Browse the repository at this point in the history
  • Loading branch information
pchelle committed Oct 18, 2023
1 parent 166d6b5 commit a7e2f1d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions R/utilities-demography.R
Original file line number Diff line number Diff line change
Expand Up @@ -520,15 +520,16 @@ getDemographyAggregatedData <- function(data,
xParameterBreaks <- unique(unname(
quantile(
x = data[, xParameterName],
probs = seq(0, 1, length.out = xParameterBreaks)
# needs to add 1 because n edges will create n-1 bins
probs = seq(0, 1, length.out = xParameterBreaks + 1)
)
))
} else {
# Split x ranges of equal length
xParameterBreaks <- unique(seq(
min(data[, xParameterName], na.rm = TRUE),
max(data[, xParameterName], na.rm = TRUE),
length.out = xParameterBreaks
length.out = xParameterBreaks + 1
))
}
}
Expand Down

0 comments on commit a7e2f1d

Please sign in to comment.