Skip to content

Commit 17acc41

Browse files
committed
Add inheritAes parameter in layers (LP #1172)
1 parent ea75797 commit 17acc41

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+333
-6
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
* Copyright (c) 2019. JetBrains s.r.o.
3+
* Use of this source code is governed by the MIT license that can be found in the LICENSE file.
4+
*/
5+
6+
package frontendContextDemo.scripts
7+
8+
import frontendContextDemo.ScriptInBatikContext
9+
import org.jetbrains.letsPlot.geom.geomPoint
10+
import org.jetbrains.letsPlot.ggplot
11+
12+
object InheritAes {
13+
@JvmStatic
14+
fun main(args: Array<String>) {
15+
ScriptInBatikContext.eval("Squares do not inherit AES") {
16+
val data = mapOf<String, Any>(
17+
"weight" to listOf(68, 84, 73),
18+
"height" to listOf(175, 169, 180),
19+
"shoe" to listOf(42, 40, 45)
20+
)
21+
22+
23+
val p = ggplot(data) {
24+
x = "weight"
25+
y = "height"
26+
size = "shoe"
27+
} +
28+
geomPoint(color = "red") +
29+
geomPoint(shape = 0, inheritAes = false) {
30+
x = "weight"
31+
y = "height"
32+
color = "shoe"
33+
}
34+
35+
p.show()
36+
}
37+
}
38+
}

future_changes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
### Added
44

55
ToDo: `geomBlank()` [[#831](https://github.com/JetBrains/lets-plot/issues/831)].
6-
ToDo: `inheritAes` parameter in layers [[#1172](https://github.com/JetBrains/lets-plot/issues/1172)].
6+
`inheritAes` parameter in layers [[#1172](https://github.com/JetBrains/lets-plot/issues/1172)].
77

88
### Changed
99

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ nexusStaging.version=0.30.0
2424
nexusPublish.version=1.3.0
2525

2626
# Also update JS version in <home>/demo/js-frontend-app/src/main/resources/index.html
27-
letsPlot.version=4.4.1
27+
letsPlot.version=4.4.2-SNAPSHOT
2828

2929
# The latest GeoTools 30-RC do not compile due to
3030
# "renaming of all "org.opengis" packages into "org.geotools.api" ones"

plot-api/src/commonMain/kotlin/org/jetbrains/letsPlot/geom/geom_abline.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ import org.jetbrains.letsPlot.pos.positionIdentity
3434
* [Position](https://lets-plot.org/kotlin/-lets--plot--kotlin/org.jetbrains.letsPlot.pos/).
3535
* @param showLegend default = true.
3636
* false - do not show legend for this layer.
37+
* @param inheritAes default = true.
38+
* false - do not combine the layer aesthetic mappings with the plot shared mappings.
3739
* @param manualKey String or result of the call to the `layerKey()` function.
3840
* The key to show in the manual legend. Specifies the text for the legend label or advanced settings using the `layerKey()` function.
3941
* @param sampling Result of the call to the `samplingXxx()` function.
@@ -63,6 +65,7 @@ class geomABLine(
6365
stat: StatOptions = Stat.identity,
6466
position: PosOptions = positionIdentity,
6567
showLegend: Boolean = true,
68+
inheritAes: Boolean? = null,
6669
manualKey: Any? = null,
6770
sampling: SamplingOptions? = null,
6871
orientation: String? = null,
@@ -83,6 +86,7 @@ class geomABLine(
8386
stat = stat,
8487
position = position,
8588
showLegend = showLegend,
89+
inheritAes = inheritAes,
8690
manualKey = manualKey,
8791
sampling = sampling,
8892
orientation = orientation

plot-api/src/commonMain/kotlin/org/jetbrains/letsPlot/geom/geom_area.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ import org.jetbrains.letsPlot.tooltips.TooltipOptions
3838
* `positionStack()`, `positionDodge()`, etc. see [Position](https://lets-plot.org/kotlin/-lets--plot--kotlin/org.jetbrains.letsPlot.pos/).
3939
* @param showLegend default = true.
4040
* false - do not show legend for this layer.
41+
* @param inheritAes default = true.
42+
* false - do not combine the layer aesthetic mappings with the plot shared mappings.
4143
* @param manualKey String or result of the call to the `layerKey()` function.
4244
* The key to show in the manual legend. Specifies the text for the legend label or advanced settings using the `layerKey()` function.
4345
* @param sampling Result of the call to the `samplingXxx()` function.
@@ -74,6 +76,7 @@ class geomArea(
7476
stat: StatOptions = identity,
7577
position: PosOptions = positionStack(),
7678
showLegend: Boolean = true,
79+
inheritAes: Boolean? = null,
7780
manualKey: Any? = null,
7881
sampling: SamplingOptions? = null,
7982
tooltips: TooltipOptions? = null,
@@ -99,6 +102,7 @@ class geomArea(
99102
stat = stat,
100103
position = position,
101104
showLegend = showLegend,
105+
inheritAes = inheritAes,
102106
manualKey = manualKey,
103107
sampling = sampling,
104108
tooltips = tooltips

plot-api/src/commonMain/kotlin/org/jetbrains/letsPlot/geom/geom_area_ridges.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ import org.jetbrains.letsPlot.tooltips.TooltipOptions
4545
* [Position](https://lets-plot.org/kotlin/-lets--plot--kotlin/org.jetbrains.letsPlot.pos/).
4646
* @param showLegend default = true.
4747
* false - do not show legend for this layer.
48+
* @param inheritAes default = true.
49+
* false - do not combine the layer aesthetic mappings with the plot shared mappings.
4850
* @param manualKey String or result of the call to the `layerKey()` function.
4951
* The key to show in the manual legend. Specifies the text for the legend label or advanced settings using the `layerKey()` function.
5052
* @param sampling Result of the call to the `samplingXxx()` function.
@@ -103,6 +105,7 @@ class geomAreaRidges(
103105
stat: StatOptions = Stat.densityRidges(),
104106
position: PosOptions = positionIdentity,
105107
showLegend: Boolean = true,
108+
inheritAes: Boolean? = null,
106109
manualKey: Any? = null,
107110
sampling: SamplingOptions? = null,
108111
tooltips: TooltipOptions? = null,
@@ -143,6 +146,7 @@ class geomAreaRidges(
143146
stat = stat,
144147
position = position,
145148
showLegend = showLegend,
149+
inheritAes = inheritAes,
146150
manualKey = manualKey,
147151
sampling = sampling,
148152
tooltips = tooltips

plot-api/src/commonMain/kotlin/org/jetbrains/letsPlot/geom/geom_band.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ import org.jetbrains.letsPlot.tooltips.TooltipOptions
2525
* see [Position](https://lets-plot.org/kotlin/-lets--plot--kotlin/org.jetbrains.letsPlot.pos/).
2626
* @param showLegend default = true.
2727
* false - do not show legend for this layer.
28+
* @param inheritAes default = true.
29+
* false - do not combine the layer aesthetic mappings with the plot shared mappings.
2830
* @param manualKey String or result of the call to the `layerKey()` function.
2931
* The key to show in the manual legend. Specifies the text for the legend label or advanced settings using the `layerKey()` function.
3032
* @param sampling Result of the call to the `samplingXxx()` function.
@@ -60,6 +62,7 @@ class geomBand(
6062
stat: StatOptions = Stat.identity,
6163
position: PosOptions = positionIdentity,
6264
showLegend: Boolean = true,
65+
inheritAes: Boolean? = null,
6366
manualKey: Any? = null,
6467
sampling: SamplingOptions? = null,
6568
tooltips: TooltipOptions? = null,
@@ -85,6 +88,7 @@ class geomBand(
8588
stat = stat,
8689
position = position,
8790
showLegend = showLegend,
91+
inheritAes = inheritAes,
8892
manualKey = manualKey,
8993
sampling = sampling,
9094
tooltips = tooltips

plot-api/src/commonMain/kotlin/org/jetbrains/letsPlot/geom/geom_bar.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ import org.jetbrains.letsPlot.tooltips.TooltipOptions
5050
* `positionStack()`, `positionDodge()`, etc. see [Position](https://lets-plot.org/kotlin/-lets--plot--kotlin/org.jetbrains.letsPlot.pos/).
5151
* @param showLegend default = true.
5252
* false - do not show legend for this layer.
53+
* @param inheritAes default = true.
54+
* false - do not combine the layer aesthetic mappings with the plot shared mappings.
5355
* @param manualKey String or result of the call to the `layerKey()` function.
5456
* The key to show in the manual legend. Specifies the text for the legend label or advanced settings using the `layerKey()` function.
5557
* @param sampling Result of the call to the `samplingXxx()` function.
@@ -86,6 +88,7 @@ class geomBar(
8688
stat: StatOptions = Stat.count(),
8789
position: PosOptions = positionStack(),
8890
showLegend: Boolean = true,
91+
inheritAes: Boolean? = null,
8992
manualKey: Any? = null,
9093
sampling: SamplingOptions? = null,
9194
tooltips: TooltipOptions? = null,
@@ -114,6 +117,7 @@ class geomBar(
114117
stat = stat,
115118
position = position,
116119
showLegend = showLegend,
120+
inheritAes = inheritAes,
117121
manualKey = manualKey,
118122
sampling = sampling,
119123
tooltips = tooltips,

plot-api/src/commonMain/kotlin/org/jetbrains/letsPlot/geom/geom_bin2d.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ import org.jetbrains.letsPlot.tooltips.TooltipOptions
4444
* [Position](https://lets-plot.org/kotlin/-lets--plot--kotlin/org.jetbrains.letsPlot.pos/).
4545
* @param showLegend default = true.
4646
* false - do not show legend for this layer.
47+
* @param inheritAes default = true.
48+
* false - do not combine the layer aesthetic mappings with the plot shared mappings.
4749
* @param manualKey String or result of the call to the `layerKey()` function.
4850
* The key to show in the manual legend. Specifies the text for the legend label or advanced settings using the `layerKey()` function.
4951
* @param sampling Result of the call to the `samplingXxx()` function.
@@ -83,6 +85,7 @@ class geomBin2D(
8385
stat: StatOptions = Stat.bin2D(),
8486
position: PosOptions = positionIdentity,
8587
showLegend: Boolean = true,
88+
inheritAes: Boolean? = null,
8689
manualKey: Any? = null,
8790
sampling: SamplingOptions? = null,
8891
tooltips: TooltipOptions? = null,
@@ -114,6 +117,7 @@ class geomBin2D(
114117
stat = stat,
115118
position = position,
116119
showLegend = showLegend,
120+
inheritAes = inheritAes,
117121
manualKey = manualKey,
118122
sampling = sampling,
119123
tooltips = tooltips

plot-api/src/commonMain/kotlin/org/jetbrains/letsPlot/geom/geom_boxplot.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ import org.jetbrains.letsPlot.tooltips.TooltipOptions
4949
* `positionStack()`, `positionDodge()`, etc. see [Position](https://lets-plot.org/kotlin/-lets--plot--kotlin/org.jetbrains.letsPlot.pos/).
5050
* @param showLegend default = true.
5151
* false - do not show legend for this layer.
52+
* @param inheritAes default = true.
53+
* false - do not combine the layer aesthetic mappings with the plot shared mappings.
5254
* @param manualKey String or result of the call to the `layerKey()` function.
5355
* The key to show in the manual legend. Specifies the text for the legend label or advanced settings using the `layerKey()` function.
5456
* @param tooltips Result of the call to the `layerTooltips()` function.
@@ -103,6 +105,7 @@ fun geomBoxplot(
103105
stat: StatOptions = Stat.boxplot(),
104106
position: PosOptions = positionDodge(),
105107
showLegend: Boolean = true,
108+
inheritAes: Boolean? = null,
106109
manualKey: Any? = null,
107110
tooltips: TooltipOptions? = null,
108111
orientation: String? = null,
@@ -146,6 +149,7 @@ fun geomBoxplot(
146149
stat,
147150
position,
148151
showLegend,
152+
inheritAes,
149153
manualKey,
150154
tooltips,
151155
orientation,
@@ -178,6 +182,7 @@ fun geomBoxplot(
178182
stat = Stat.boxplotOutlier(),
179183
position = position,
180184
showLegend = false,
185+
inheritAes = inheritAes,
181186
manualKey = null,
182187
sampling = null,
183188
orientation = orientation,
@@ -202,6 +207,7 @@ private class geomBoxplotInternal(
202207
stat: StatOptions = Stat.boxplot(),
203208
position: PosOptions = positionDodge(),
204209
showLegend: Boolean = true,
210+
inheritAes: Boolean? = null,
205211
manualKey: Any? = null,
206212
tooltips: TooltipOptions? = null,
207213
orientation: String? = null,
@@ -242,6 +248,7 @@ private class geomBoxplotInternal(
242248
stat = stat,
243249
position = position,
244250
showLegend = showLegend,
251+
inheritAes = inheritAes,
245252
manualKey = manualKey,
246253
sampling = null,
247254
tooltips = tooltips,

0 commit comments

Comments
 (0)