diff --git a/plot-api/src/commonMain/kotlin/org/jetbrains/letsPlot/bistro/common/Plot2dUtil.kt b/plot-api/src/commonMain/kotlin/org/jetbrains/letsPlot/bistro/common/Plot2dUtil.kt index 1a589c379..f5a104297 100644 --- a/plot-api/src/commonMain/kotlin/org/jetbrains/letsPlot/bistro/common/Plot2dUtil.kt +++ b/plot-api/src/commonMain/kotlin/org/jetbrains/letsPlot/bistro/common/Plot2dUtil.kt @@ -94,11 +94,12 @@ object Plot2dUtil { alpha: Number?, colorBy: String?, showLegend: Boolean, + manualKey: Any?, ): Feature { return when (geomKind) { "point" -> { - geomPoint(color = color, size = size, alpha = alpha, showLegend = showLegend) + geomPoint(color = color, size = size, alpha = alpha, showLegend = showLegend, manualKey = manualKey) } "tile" -> { @@ -108,7 +109,8 @@ object Plot2dUtil { color = color, size = size, alpha = alpha, - showLegend = showLegend + showLegend = showLegend, + manualKey = manualKey ) { fill = colorBy.takeIf { it != null } ?: "..count.." } @@ -119,7 +121,8 @@ object Plot2dUtil { color = color, size = size, alpha = alpha, - showLegend = showLegend + showLegend = showLegend, + manualKey = manualKey ) { this.color = colorBy.takeIf { it != null } ?: "..group.." } @@ -130,7 +133,8 @@ object Plot2dUtil { color = color, size = size, alpha = alpha, - showLegend = showLegend + showLegend = showLegend, + manualKey = manualKey ) { fill = colorBy.takeIf { it != null } ?: "..group.." } @@ -148,7 +152,8 @@ object Plot2dUtil { binWidth2d: Pair?, color: String?, colorBy: String?, - showLegend: Boolean + showLegend: Boolean, + manualKey: Any? ): Feature { fun parseMarginalLayer(geomKind: String, side: Char, size: Any?): Feature { val marginalColor = when { @@ -164,7 +169,8 @@ object Plot2dUtil { color = marginalColor, fill = marginalColor, alpha = MARGINAL_ALPHA, - showLegend = showLegend + showLegend = showLegend, + manualKey = manualKey ) } @@ -185,7 +191,8 @@ object Plot2dUtil { alpha = MARGINAL_ALPHA, bins = bins, binWidth = binWidth, - showLegend = showLegend + showLegend = showLegend, + manualKey = manualKey ) } @@ -194,7 +201,8 @@ object Plot2dUtil { color = marginalColor, fill = marginalColor, alpha = MARGINAL_ALPHA, - showLegend = showLegend + showLegend = showLegend, + manualKey = manualKey ) } diff --git a/plot-api/src/commonMain/kotlin/org/jetbrains/letsPlot/bistro/joint/JointPlot.kt b/plot-api/src/commonMain/kotlin/org/jetbrains/letsPlot/bistro/joint/JointPlot.kt index dce4fa1e5..4d68c62d1 100644 --- a/plot-api/src/commonMain/kotlin/org/jetbrains/letsPlot/bistro/joint/JointPlot.kt +++ b/plot-api/src/commonMain/kotlin/org/jetbrains/letsPlot/bistro/joint/JointPlot.kt @@ -73,6 +73,7 @@ fun jointPlot( alpha: Number? = null, colorBy: String? = null, showLegend: Boolean = true, + manualKey: Any? = null, regLine: Boolean? = null, se: Boolean = true, marginal: String? = null @@ -88,6 +89,7 @@ fun jointPlot( alpha, colorBy, showLegend, + manualKey, regLine, se, marginal diff --git a/plot-api/src/commonMain/kotlin/org/jetbrains/letsPlot/bistro/joint/JointPlotBuilder.kt b/plot-api/src/commonMain/kotlin/org/jetbrains/letsPlot/bistro/joint/JointPlotBuilder.kt index b34d7cbc1..b67f87d7d 100644 --- a/plot-api/src/commonMain/kotlin/org/jetbrains/letsPlot/bistro/joint/JointPlotBuilder.kt +++ b/plot-api/src/commonMain/kotlin/org/jetbrains/letsPlot/bistro/joint/JointPlotBuilder.kt @@ -28,6 +28,7 @@ internal class JointPlotBuilder( private val alpha: Number?, private val colorBy: String?, private val showLegend: Boolean, + private val manualKey: Any?, private val regLine: Boolean?, private val se: Boolean, private val marginal: String? @@ -64,7 +65,8 @@ internal class JointPlotBuilder( size, alpha, colorBy, - showLegend + showLegend, + manualKey ) // smooth layer @@ -94,7 +96,8 @@ internal class JointPlotBuilder( binWidth2d, color, colorBy, - showLegend + showLegend, + manualKey ) } diff --git a/plot-api/src/commonMain/kotlin/org/jetbrains/letsPlot/bistro/qq/QQPlot.kt b/plot-api/src/commonMain/kotlin/org/jetbrains/letsPlot/bistro/qq/QQPlot.kt index 5b2ce8dfb..101f6a171 100644 --- a/plot-api/src/commonMain/kotlin/org/jetbrains/letsPlot/bistro/qq/QQPlot.kt +++ b/plot-api/src/commonMain/kotlin/org/jetbrains/letsPlot/bistro/qq/QQPlot.kt @@ -76,6 +76,7 @@ fun qqPlot( quantiles: Pair? = null, group: String? = null, showLegend: Boolean = true, + manualKey: Any? = null, color: String? = null, fill: String? = null, alpha: Number? = null, @@ -94,6 +95,7 @@ fun qqPlot( quantiles, group, showLegend, + manualKey, color, fill, alpha, diff --git a/plot-api/src/commonMain/kotlin/org/jetbrains/letsPlot/bistro/qq/QQPlotBuilder.kt b/plot-api/src/commonMain/kotlin/org/jetbrains/letsPlot/bistro/qq/QQPlotBuilder.kt index 76bd40787..d15a1db85 100644 --- a/plot-api/src/commonMain/kotlin/org/jetbrains/letsPlot/bistro/qq/QQPlotBuilder.kt +++ b/plot-api/src/commonMain/kotlin/org/jetbrains/letsPlot/bistro/qq/QQPlotBuilder.kt @@ -37,6 +37,7 @@ internal class QQPlotBuilder( private val quantiles: Pair? = null, private val group: String? = null, private val showLegend: Boolean = true, + private val manualKey: Any? = null, private val color: String? = null, private val fill: String? = null, alpha: Number? = null, @@ -69,6 +70,7 @@ internal class QQPlotBuilder( val mapping = qqMapping() return geomQQ( showLegend = showLegend, + manualKey = manualKey, color = color, fill = fill, alpha = myAlpha, @@ -77,6 +79,7 @@ internal class QQPlotBuilder( stat = Stat.qq(myDistribution, dParams, mapping) ) + geomQQLine( showLegend = showLegend, + manualKey = manualKey, color = myLineColor, size = myLineSize, linetype = linetype, @@ -88,6 +91,7 @@ internal class QQPlotBuilder( val mapping = qq2Mapping() return geomQQ2( showLegend = showLegend, + manualKey = manualKey, color = color, fill = fill, alpha = myAlpha, @@ -96,6 +100,7 @@ internal class QQPlotBuilder( stat = Stat.qq2(mapping) ) + geomQQ2Line( showLegend = showLegend, + manualKey = manualKey, color = myLineColor, size = myLineSize, linetype = linetype, diff --git a/plot-api/src/commonMain/kotlin/org/jetbrains/letsPlot/bistro/residual/ResidualPlot.kt b/plot-api/src/commonMain/kotlin/org/jetbrains/letsPlot/bistro/residual/ResidualPlot.kt index 1aa5c77bd..923ad1795 100644 --- a/plot-api/src/commonMain/kotlin/org/jetbrains/letsPlot/bistro/residual/ResidualPlot.kt +++ b/plot-api/src/commonMain/kotlin/org/jetbrains/letsPlot/bistro/residual/ResidualPlot.kt @@ -91,6 +91,7 @@ fun residualPlot( alpha: Number? = null, colorBy: String? = null, showLegend: Boolean = true, + manualKey: Any? = null, hline: Boolean = true, marginal: String = ResidualPlotBuilder.DEF_MARGINAL ) = ResidualPlotBuilder( @@ -110,6 +111,7 @@ fun residualPlot( alpha, colorBy, showLegend, + manualKey, hline, marginal ).build() \ No newline at end of file diff --git a/plot-api/src/commonMain/kotlin/org/jetbrains/letsPlot/bistro/residual/ResidualPlotBuilder.kt b/plot-api/src/commonMain/kotlin/org/jetbrains/letsPlot/bistro/residual/ResidualPlotBuilder.kt index 184e31a0f..8d3a66e67 100644 --- a/plot-api/src/commonMain/kotlin/org/jetbrains/letsPlot/bistro/residual/ResidualPlotBuilder.kt +++ b/plot-api/src/commonMain/kotlin/org/jetbrains/letsPlot/bistro/residual/ResidualPlotBuilder.kt @@ -33,6 +33,7 @@ internal class ResidualPlotBuilder( private val alpha: Number?, private val colorBy: String?, private val showLegend: Boolean, + private val manualKey: Any?, private val hline: Boolean, private val marginal: String ) { @@ -93,7 +94,8 @@ internal class ResidualPlotBuilder( size, alpha, colorBy, - showLegend + showLegend, + manualKey ) // HLine @@ -103,7 +105,7 @@ internal class ResidualPlotBuilder( // marginals if (marginal != "none") { - layers += Plot2dUtil.getMarginalLayers(marginal, bins2d, binWidth2d, color, colorBy, showLegend) + layers += Plot2dUtil.getMarginalLayers(marginal, bins2d, binWidth2d, color, colorBy, showLegend, manualKey) } return layers