Skip to content

Commit d4974c4

Browse files
Add geomPointDensity support in JointPlot
1 parent f9928cf commit d4974c4

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

demo/jvm-batik/src/main/kotlin/frontendContextDemo/scripts/JointPlot.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,12 @@ object JointPlot {
6666
scaleFillGradient(low = "#d95f0e", high = "#fff7bc")
6767
p.show()
6868
}
69+
70+
run {
71+
val p =
72+
jointPlot(irisData, "petal length (cm)", "petal width (cm)", colorBy = "target", geom = "pointdensity")
73+
p.show()
74+
}
6975
}
7076
}
7177
}

plot-api/src/commonMain/kotlin/org/jetbrains/letsPlot/bistro/common/Plot2dUtil.kt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,17 @@ object Plot2dUtil {
136136
}
137137
}
138138

139+
"pointdensity" -> {
140+
geomPointDensity(
141+
color = color,
142+
size = size,
143+
alpha = alpha,
144+
showLegend = showLegend
145+
) {
146+
fill = colorBy.takeIf { it != null } ?: "..density.."
147+
}
148+
}
149+
139150
"none" -> DummyFeature
140151

141152
else -> throw IllegalArgumentException("Unknown geom: $geomKind")

plot-api/src/commonMain/kotlin/org/jetbrains/letsPlot/bistro/joint/JointPlot.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ package org.jetbrains.letsPlot.bistro.joint
2020
* @param data The data to be displayed.
2121
* @param x Name of the variable.
2222
* @param y Name of the variable.
23-
* @param geom default = "point" ("point", "tile", "density2d", "density2df", "none").
23+
* @param geom default = "point" ("point", "tile", "density2d", "density2df", "pointdensity", "none").
2424
* The geometric object to use to display the data. No object will be used if `geom="none"`.
2525
* @param bins Number or a Pair of Numbers.
2626
* Number of bins in both directions, vertical and horizontal. Overridden by `binWidth`.

0 commit comments

Comments
 (0)