Skip to content

Commit

Permalink
Fix #1189 : ggmarginal: bottom boxplot is broken.
Browse files Browse the repository at this point in the history
  • Loading branch information
alshan committed Sep 17, 2024
1 parent fd41708 commit 9c7a3e0
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 12 deletions.
3 changes: 2 additions & 1 deletion future_changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@
- Legend icon background should inherit the fill color of the plot panel (i.e. grey when `theme_grey` is used).
- Vertex sampling uses different tolerances for objects within the same plot [[#1174](https://github.com/JetBrains/lets-plot/issues/1174)].
- sampling_vertex_vw doesn't work as expected [[#1175](https://github.com/JetBrains/lets-plot/issues/1175)].
- sampling_vertex_dp may break rings [[#1176](https://github.com/JetBrains/lets-plot/issues/1176)].
- sampling_vertex_dp may break rings [[#1176](https://github.com/JetBrains/lets-plot/issues/1176)].
- ggmarginal: bottom boxplot is broken [[#1189](https://github.com/JetBrains/lets-plot/issues/1189)].
Original file line number Diff line number Diff line change
Expand Up @@ -28,25 +28,36 @@ internal object PlotGeomTilesUtil {
commonScales: Map<Aes<*>, Scale>,
): Map<Aes<*>, Scale> {

val layerRenamedScales = namePositionalScalesAfterStatVariables(
layerConfig.varBindings,
layerConfig.isYOrientation,
commonScales
)

val layerScales = commonScales + layerRenamedScales
return when (layerConfig.isMarginal) {
val layerCommonScales = when (layerConfig.isMarginal) {
true -> MarginalLayerUtil.toMarginalScaleMap(
layerScales,
commonScales,
layerConfig.marginalSide,
flipOrientation = false // Positional aes are already flipped in the "common scale map".
)

false -> layerScales
false -> commonScales
}

val layerAddedScales = createScalesForPositionalStatVariables(
layerConfig.varBindings,
layerConfig.isYOrientation,
commonScales
).let { scaleByAes ->
when (layerConfig.isMarginal) {
true -> MarginalLayerUtil.toMarginalScaleMap(
scaleByAes,
layerConfig.marginalSide,
flipOrientation = layerConfig.isYOrientation
)

false -> scaleByAes
}
}

return layerCommonScales + layerAddedScales
}

private fun namePositionalScalesAfterStatVariables(
private fun createScalesForPositionalStatVariables(
layerVarBindings: List<VarBinding>,
isYOrientation: Boolean,
commonScaleMap: Map<Aes<*>, Scale>,
Expand Down

0 comments on commit 9c7a3e0

Please sign in to comment.