Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix calculation of XY-ranges for geom_errorbar #770

Merged
merged 6 commits into from
May 2, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix requirements for the specified aesthetics for the errorbar.
  • Loading branch information
OLarionova-HORIS committed May 2, 2023
commit 980973d8387d2ea203de449d1f5bc0da185cfa4c
Original file line number Diff line number Diff line change
Expand Up @@ -289,16 +289,14 @@ class GeomLayerBuilder(
// Check that the settings are consistent
// and set the aesthetics needed for that geometry.
val definedAes = allRenderedAes.filter { aes -> hasBinding(aes) || hasConstant(aes) }
val verticalAesSet = setOf(Aes.X, Aes.YMIN, Aes.YMAX)
val horizontalAesSet = setOf(Aes.Y, Aes.XMIN, Aes.XMAX)
val isVertical = verticalAesSet.all { aes -> aes in definedAes }
val isHorizontal = horizontalAesSet.all { aes -> aes in definedAes }
val isVertical = setOf(Aes.YMIN, Aes.YMAX).all { aes -> aes in definedAes }
val isHorizontal = setOf(Aes.XMIN, Aes.XMAX).all { aes -> aes in definedAes }
require(!(isVertical && isHorizontal)) {
"For errorbar either x, ymin, ymax or y, xmin, xmax must be specified."
"Either ymin, ymax or xmin, xmax must be specified for the errorbar."
}
allRenderedAes - when (isVertical) {
true -> horizontalAesSet + Aes.HEIGHT
false -> verticalAesSet + Aes.WIDTH
true -> setOf(Aes.Y, Aes.XMIN, Aes.XMAX, Aes.HEIGHT)
false -> setOf(Aes.X, Aes.YMIN, Aes.YMAX, Aes.WIDTH)
}
} else {
allRenderedAes
Expand Down