Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
121 commits
Select commit Hold shift + click to select a range
b66c269
Update docstring for geom_point() function.
ASmirnov-HORIS Feb 16, 2021
b760969
Docstring: Update data, map and map_join parameters description.
ASmirnov-HORIS Feb 25, 2021
639b438
Updated core.py docstrings.
EArkhipova-HORIS Feb 26, 2021
7a6ba28
Minor fixes
EArkhipova-HORIS Mar 2, 2021
3003b51
Update examples in coord.py docstrings, update geom_extras.py docstrings
EArkhipova-HORIS Mar 3, 2021
f27c925
Docstrings: replace >>> to :linenos: in geom.py.
ASmirnov-HORIS Mar 12, 2021
19f7c85
Update examples in plot.py, update docstring in label.py.
EArkhipova-HORIS Mar 15, 2021
d33102b
Update docstring for the geocode() function.
ASmirnov-HORIS Mar 17, 2021
33afa10
Update docstrings in geo_data.
ASmirnov-HORIS Mar 19, 2021
b33d331
Add link to documentation page for formatting in tooltips and geom_te…
ASmirnov-HORIS Mar 24, 2021
ab0cb8c
Fix lists in docstrings notes (according to Numpydoc and rst rules).
ASmirnov-HORIS Mar 24, 2021
c8c1ced
Update links in docstrings.
ASmirnov-HORIS Mar 24, 2021
f019ead
Fix errors of the rebase conflicts resolving.
ASmirnov-HORIS Aug 20, 2021
e5b5038
Merge branch 'master' of github.com:JetBrains/lets-plot
ASmirnov-HORIS Aug 26, 2021
48361d9
Merge branch 'master' of github.com:JetBrains/lets-plot
ASmirnov-HORIS Aug 27, 2021
b6ede67
Merge branch 'master' of github.com:JetBrains/lets-plot
ASmirnov-HORIS Sep 2, 2021
9c99338
Merge branch 'master' of github.com:JetBrains/lets-plot
ASmirnov-HORIS Sep 13, 2021
cb78333
Merge branch 'master' of github.com:JetBrains/lets-plot
ASmirnov-HORIS Sep 21, 2021
839fac0
Merge branch 'master' of github.com:JetBrains/lets-plot
ASmirnov-HORIS Sep 24, 2021
6f5efba
Merge branch 'master' of github.com:JetBrains/lets-plot
ASmirnov-HORIS Sep 27, 2021
6af62fb
Merge branch 'master' of github.com:JetBrains/lets-plot
ASmirnov-HORIS Sep 29, 2021
153dfc6
Merge branch 'master' of github.com:JetBrains/lets-plot
ASmirnov-HORIS Oct 12, 2021
14bb83e
Merge branch 'master' of github.com:JetBrains/lets-plot
ASmirnov-HORIS Oct 13, 2021
b0580ea
Add violin geom without any functionality.
ASmirnov-HORIS Oct 15, 2021
600f485
Merge branch 'master' of github.com:JetBrains/lets-plot
ASmirnov-HORIS Oct 15, 2021
bac7d14
Merge branch 'master' of github.com:JetBrains/lets-plot
ASmirnov-HORIS Oct 18, 2021
5fa1b0b
Merge branch 'master' of github.com:JetBrains/lets-plot
ASmirnov-HORIS Oct 19, 2021
91d9c8d
Merge branch 'master' of github.com:JetBrains/lets-plot
ASmirnov-HORIS Oct 20, 2021
c25215b
Merge branch 'master' of github.com:JetBrains/lets-plot
ASmirnov-HORIS Oct 20, 2021
60b9d43
Update docstring for geom_point() function.
ASmirnov-HORIS Feb 16, 2021
7d56a67
Docstring: Update data, map and map_join parameters description.
ASmirnov-HORIS Feb 25, 2021
0b81f55
Minor fixes
EArkhipova-HORIS Mar 2, 2021
43b1e8f
Update examples in coord.py docstrings, update geom_extras.py docstrings
EArkhipova-HORIS Mar 3, 2021
4beaf1e
Update examples in plot.py, update docstring in label.py.
EArkhipova-HORIS Mar 15, 2021
0b54bd5
Add link to documentation page for formatting in tooltips and geom_te…
ASmirnov-HORIS Mar 24, 2021
48e15f6
Fix lists in docstrings notes (according to Numpydoc and rst rules).
ASmirnov-HORIS Mar 24, 2021
e99686a
Update links in docstrings.
ASmirnov-HORIS Mar 24, 2021
c4a0b86
Fix errors of the rebase conflicts resolving.
ASmirnov-HORIS Aug 20, 2021
e7f8980
Merge branch 'master' of github.com:ASmirnov-HORIS/lets-plot
ASmirnov-HORIS Oct 20, 2021
41d6282
Merge branch 'master' of github.com:JetBrains/lets-plot
ASmirnov-HORIS Oct 21, 2021
33aad73
Merge branch 'master' of github.com:JetBrains/lets-plot
ASmirnov-HORIS Oct 25, 2021
2c759f4
Merge branch 'master' of github.com:JetBrains/lets-plot
ASmirnov-HORIS Oct 26, 2021
d29429c
Merge branch 'master' of github.com:JetBrains/lets-plot
ASmirnov-HORIS Oct 28, 2021
ac7254e
Merge branch 'master' of github.com:JetBrains/lets-plot
ASmirnov-HORIS Oct 28, 2021
77f8884
Merge branch 'master' of github.com:JetBrains/lets-plot
ASmirnov-HORIS Oct 29, 2021
fbdac79
Fix in plot-demo-common/.../Violin.
ASmirnov-HORIS Nov 1, 2021
8d833f0
Merge branch 'master' of github.com:JetBrains/lets-plot
ASmirnov-HORIS Nov 1, 2021
cc80168
Fix conflicts after merging with upstream/master.
ASmirnov-HORIS Nov 1, 2021
3966ed8
Trying to show at least vertical line for violin geom.
ASmirnov-HORIS Nov 2, 2021
0819ad1
Fix aesthetics for the violin geom.
ASmirnov-HORIS Nov 18, 2021
0d060b0
Replace statistic for violin geom to its own.
ASmirnov-HORIS Nov 18, 2021
6126177
Upgrade the violin statistic.
ASmirnov-HORIS Nov 19, 2021
e0308a9
Fix an error in the violin stat.
ASmirnov-HORIS Nov 19, 2021
41d12b3
Upgrade the geometry of the violin.
ASmirnov-HORIS Nov 22, 2021
2dd3595
Fix width for the geom violin. Hints also added but stil doesn't work.
ASmirnov-HORIS Nov 23, 2021
432bab9
Fix tooltips for geom violin.
ASmirnov-HORIS Nov 23, 2021
0e246f1
Merge branch 'master' of github.com:JetBrains/lets-plot
ASmirnov-HORIS Nov 23, 2021
c0fea5e
Use the 'DensityStat' in the 'ViolinStat'.
ASmirnov-HORIS Nov 24, 2021
4b95827
Remove the first version of the ViolinStat realization. Tiny fixes in…
ASmirnov-HORIS Nov 25, 2021
b2abedd
Merge branch 'master' of github.com:JetBrains/lets-plot
ASmirnov-HORIS Nov 25, 2021
57b5850
Tiny fixes.
ASmirnov-HORIS Nov 26, 2021
ebaf834
Add WEIGHT to the 'noGuideNeeded' aesthetics list.
ASmirnov-HORIS Nov 26, 2021
770793a
Add statistics COUNT and SCALED to the ViolinStat.
ASmirnov-HORIS Nov 26, 2021
7b859e4
Switch to the first version of the ViolinStat (with tiny modifications).
ASmirnov-HORIS Nov 30, 2021
b02d58c
Small refactoring and new parameters in the ViolinStat.
ASmirnov-HORIS Dec 1, 2021
7418aa7
Remove one extra space.
ASmirnov-HORIS Dec 1, 2021
34b6d61
Move the densityFunction() to the DensityStatUtil.
ASmirnov-HORIS Dec 1, 2021
7390463
Add the 'Nullable Test' and fix the corresponding bug.
ASmirnov-HORIS Dec 1, 2021
7e024cb
Add the notebook for demonstrating the new geometry.
ASmirnov-HORIS Dec 1, 2021
2e3d148
Rename the directory: docs/f-01-11/ -> docs/f-21-12/.
ASmirnov-HORIS Dec 2, 2021
d66bdcc
Add 'violinwidth' aesthetic and '..violinwidth..' statistic. Now the …
ASmirnov-HORIS Dec 3, 2021
781b5a5
Merge branch 'master' of github.com:JetBrains/lets-plot
ASmirnov-HORIS Dec 7, 2021
1774a64
Merge branch 'master' of github.com:JetBrains/lets-plot
ASmirnov-HORIS Dec 9, 2021
274089d
Rename ViolinStat to YDensityStat and other small fixes.
ASmirnov-HORIS Dec 16, 2021
69436db
Move calculation of the ..violinwidth.. to the normalize() method.
ASmirnov-HORIS Dec 16, 2021
73d451d
Tiny fix.
ASmirnov-HORIS Dec 16, 2021
64de861
Fixes in ViolinGeom, YDensityStat. Update some names.
ASmirnov-HORIS Dec 17, 2021
34087a1
Update ViolinGeom for better performance.
ASmirnov-HORIS Dec 17, 2021
5810a83
Fix tests.
ASmirnov-HORIS Dec 20, 2021
219e4e4
Small fixes. Mostly in names.
ASmirnov-HORIS Dec 20, 2021
761ccdb
Updates in YDensityStat: more clear normalization.
ASmirnov-HORIS Dec 20, 2021
253d8c2
Fix error for empty dataframe in normalize() for YDensityStat.
ASmirnov-HORIS Dec 21, 2021
d639577
Merge branch 'master' of github.com:JetBrains/lets-plot
ASmirnov-HORIS Dec 29, 2021
26019fd
Add the draw_quantiles parameter to the geom_violin().
ASmirnov-HORIS Jan 18, 2022
4cdbe48
Add hints for quantiles to the geom_violin().
ASmirnov-HORIS Jan 19, 2022
27dacc0
Fix hint texts for quantiles to the geom_violin().
ASmirnov-HORIS Jan 19, 2022
1c1ca39
Add the quantile aesthetic.
ASmirnov-HORIS Jan 20, 2022
0c610a1
Remove the quantile aesthetic. Remove all hints except the axis ones.
ASmirnov-HORIS Jan 20, 2022
aa9d94e
Remove the quantile hints from geom_violin().
ASmirnov-HORIS Jan 21, 2022
73cdbb9
Add the scale parameter to the geom_violin().
ASmirnov-HORIS Jan 21, 2022
d67f424
Use the new option accessor for the draw_quantiles parameter of the g…
ASmirnov-HORIS Jan 24, 2022
b3cfbb1
Update demo for Violin.
ASmirnov-HORIS Jan 25, 2022
f404b16
Hide quantiles for Violin.
ASmirnov-HORIS Jan 25, 2022
90d9247
Special data for width error in Violin.
ASmirnov-HORIS Jan 25, 2022
514c209
Violin: remove WIDTH_SCALE from ViolinGeom, add WIDTH aesthetic and u…
ASmirnov-HORIS Jan 26, 2022
0eee9ab
Use width aesthetic in the ViolinGeom, and add new demo for debugging…
ASmirnov-HORIS Jan 27, 2022
606e5c8
Update demo for debugging the violins.
ASmirnov-HORIS Jan 27, 2022
32bfba3
Merge branch 'master' of github.com:JetBrains/lets-plot
ASmirnov-HORIS Jan 27, 2022
37d3d3b
Merge branch 'master' into geom_violin
ASmirnov-HORIS Jan 27, 2022
e388e95
Fix conflicts after merging with master.
ASmirnov-HORIS Jan 27, 2022
ecf42d0
Fix another one conflict after merging with master.
ASmirnov-HORIS Jan 27, 2022
b01377d
Make width aesthetic to constant for violin geom. Fix the demo examples.
ASmirnov-HORIS Feb 1, 2022
1e95198
Merge branch 'master' of github.com:JetBrains/lets-plot
ASmirnov-HORIS Feb 1, 2022
8e27c10
Merge branch 'master' into geom_violin
ASmirnov-HORIS Feb 1, 2022
207d035
Fix demo for the identity stat for violin.
ASmirnov-HORIS Feb 1, 2022
260e0e6
Another demo for debugging violins.
ASmirnov-HORIS Feb 1, 2022
573793a
Merge branch 'master' of github.com:JetBrains/lets-plot
ASmirnov-HORIS Feb 2, 2022
0e101d0
Merge branch 'master' into geom_violin
ASmirnov-HORIS Feb 2, 2022
b78b893
Update demo for debugging violins.
ASmirnov-HORIS Feb 2, 2022
86ef532
Fix problem with grouped quantiles.
ASmirnov-HORIS Feb 2, 2022
c34046c
Fix width in YDensityStat and update some comments.
ASmirnov-HORIS Feb 2, 2022
c502f9b
Remove extra WIDTH from the YDensityStat.
ASmirnov-HORIS Feb 3, 2022
3b22588
Tiny fix in naming.
ASmirnov-HORIS Feb 3, 2022
a2d32c5
Remove extra constant from the YDensityStat.
ASmirnov-HORIS Feb 3, 2022
f71581f
Merge branch 'master' of github.com:JetBrains/lets-plot
ASmirnov-HORIS Feb 3, 2022
9cd0dee
Merge branch 'master' of github.com:JetBrains/lets-plot
ASmirnov-HORIS Feb 4, 2022
aa283e3
Add docstring to the geom_violin() and update the demo notebook.
ASmirnov-HORIS Feb 9, 2022
2c3ba81
Merge branch 'master' of github.com:JetBrains/lets-plot
ASmirnov-HORIS Feb 21, 2022
1258fd8
Merge branch 'master' of github.com:JetBrains/lets-plot
ASmirnov-HORIS Feb 24, 2022
d373481
Merge branch 'master' into geom_violin
ASmirnov-HORIS Feb 24, 2022
ea0feda
Add YDensityStatTest.
ASmirnov-HORIS Feb 25, 2022
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
1,087 changes: 585 additions & 502 deletions docs/f-21-12/notebooks/geom_violin.ipynb

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
/*
* Copyright (c) 2022. JetBrains s.r.o.
* Use of this source code is governed by the MIT license that can be found in the LICENSE file.
*/

package jetbrains.datalore.plot.base.stat

import jetbrains.datalore.base.gcommon.collect.ClosedRange
import jetbrains.datalore.plot.base.DataFrame
import jetbrains.datalore.plot.base.StatContext
import jetbrains.datalore.plot.base.data.TransformVar
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertTrue

class YDensityStatTest {
private fun statContext(d: DataFrame): StatContext {
return SimpleStatContext(d)
}

private fun dataFrame(dataMap: Map<DataFrame.Variable, List<Double?>>): DataFrame {
val builder = DataFrame.Builder()
for (key in dataMap.keys) {
builder.put(key, dataMap.getValue(key))
}
return builder.build()
}

private fun filteredDataFrame(df: DataFrame, variable: DataFrame.Variable, filterFun: (Double?) -> Boolean): DataFrame {
val indices = df.getNumeric(variable)
.mapIndexed { index, v -> if (filterFun(v)) index else null }
.filterNotNull()

return df.selectIndices(indices)
}

private fun yDensityStat(scale: YDensityStat.Scale? = null): YDensityStat {
return YDensityStat(
scale = scale ?: YDensityStat.DEF_SCALE,
bandWidth = null,
bandWidthMethod = DensityStat.DEF_BW,
adjust = DensityStat.DEF_ADJUST,
kernel = DensityStat.DEF_KERNEL,
n = DensityStat.DEF_N,
fullScanMax = DensityStat.DEF_FULL_SCAN_MAX
)
}

private fun checkStatVar(statDf: DataFrame, variable: DataFrame.Variable) {
assertTrue(statDf.has(variable), "Has var " + variable.name)
}

private fun checkStatVarAndValuesDomain(statDf: DataFrame, variable: DataFrame.Variable, expectedValuesDomain: Set<Double?>) {
checkStatVar(statDf, variable)
assertEquals(statDf.getNumeric(variable).toSet(), expectedValuesDomain, "Unique values of var " + variable.name)
}

private fun checkStatVarAndValuesRange(statDf: DataFrame, variable: DataFrame.Variable, expectedValuesRange: ClosedRange<Double>) {
checkStatVar(statDf, variable)
val actualMinValue = statDf.getNumeric(variable).minByOrNull { it!! }!!
assertEquals(expectedValuesRange.lowerEnd, actualMinValue, "Min value of var " + variable.name)
val actualMaxValue = statDf.getNumeric(variable).maxByOrNull { it!! }!!
assertEquals(expectedValuesRange.upperEnd, actualMaxValue, "Max value of var " + variable.name)
}

private fun checkStatVarAndMaxValue(statDf: DataFrame, variable: DataFrame.Variable, expectedMaxValue: Double) {
checkStatVar(statDf, variable)
val actualMaxValue = statDf.getNumeric(variable).maxByOrNull { it!! }!!
assertEquals(expectedMaxValue, actualMaxValue, "Max value of var " + variable.name)
}

private fun checkStatVarAndMaxLimit(statDf: DataFrame, variable: DataFrame.Variable, expectedMaxLimit: Double) {
checkStatVar(statDf, variable)
val actualMaxValue = statDf.getNumeric(variable).maxByOrNull { it!! }!!
assertTrue(expectedMaxLimit - actualMaxValue > 0, "Max value of var " + variable.name + " limited")
}

@Test
fun emptyDataFrame() {
val df = dataFrame(emptyMap())
val stat = yDensityStat()
val statDf = stat.normalize(stat.apply(df, statContext(df)))

checkStatVarAndValuesDomain(statDf, Stats.X, emptySet())
checkStatVarAndValuesDomain(statDf, Stats.Y, emptySet())
checkStatVarAndValuesDomain(statDf, Stats.VIOLIN_WIDTH, emptySet())
}

@Test
fun oneElementDataFrame() {
val yValue = 3.14
val df = dataFrame(mapOf(
TransformVar.Y to listOf(yValue)
))
val stat = yDensityStat()
val statDf = stat.normalize(stat.apply(df, statContext(df)))

checkStatVarAndValuesDomain(statDf, Stats.X, setOf(0.0))
checkStatVarAndMaxValue(statDf, Stats.VIOLIN_WIDTH, 1.0)
}

@Test
fun twoElementsInDataFrame() {
val y = listOf(2.71, 3.14)
val df = dataFrame(mapOf(
TransformVar.Y to y
))
val stat = yDensityStat()
val statDf = stat.normalize(stat.apply(df, statContext(df)))

checkStatVarAndValuesDomain(statDf, Stats.X, setOf(0.0))
checkStatVarAndValuesRange(statDf, Stats.Y, ClosedRange(2.71, 3.14))
checkStatVarAndMaxValue(statDf, Stats.VIOLIN_WIDTH, 1.0)
}

@Test
fun withNanValues() {
val x = listOf(null, 4.0, 3.0, 3.0, 1.0, 1.0, 2.0, 2.0)
val y = listOf(3.0, null, 2.0, 3.0, 0.0, 1.0, 1.0, 2.0)
val df = dataFrame(mapOf(
TransformVar.X to x,
TransformVar.Y to y
))
val stat = yDensityStat()
val statDf = stat.normalize(stat.apply(df, statContext(df)))

checkStatVarAndValuesDomain(statDf, Stats.X, setOf(1.0, 2.0, 3.0))
checkStatVarAndValuesRange(statDf, Stats.Y, ClosedRange(0.0, 3.0))
checkStatVarAndMaxValue(statDf, Stats.VIOLIN_WIDTH, 1.0)
}

@Test
fun changeScales() {
val x = listOf(0.0, 0.0, 0.0, 0.0, 1.0, 1.0)
val y = listOf(0.0, 1.0, 2.0, 3.0, 0.0, 1.0)
val df = dataFrame(mapOf(
TransformVar.X to x,
TransformVar.Y to y
))

for (scale in YDensityStat.Scale.values()) {
val stat = yDensityStat(scale = scale)
val statDf = stat.normalize(stat.apply(df, statContext(df)))
val statDf0 = filteredDataFrame(statDf, Stats.X) { it == 0.0 }
val statDf1 = filteredDataFrame(statDf, Stats.X) { it == 1.0 }

checkStatVarAndValuesDomain(statDf, Stats.X, setOf(0.0, 1.0))
checkStatVarAndValuesRange(statDf0, Stats.Y, ClosedRange(0.0, 3.0))
checkStatVarAndValuesRange(statDf1, Stats.Y, ClosedRange(0.0, 1.0))
when (scale) {
YDensityStat.Scale.AREA -> {
checkStatVarAndMaxLimit(statDf0, Stats.VIOLIN_WIDTH, 0.5)
checkStatVarAndMaxValue(statDf1, Stats.VIOLIN_WIDTH, 1.0)
}
YDensityStat.Scale.COUNT -> {
checkStatVarAndMaxLimit(statDf0, Stats.VIOLIN_WIDTH, 0.5)
checkStatVarAndMaxValue(statDf1, Stats.VIOLIN_WIDTH, 0.5)
}
YDensityStat.Scale.WIDTH -> {
checkStatVarAndMaxValue(statDf0, Stats.VIOLIN_WIDTH, 1.0)
checkStatVarAndMaxValue(statDf1, Stats.VIOLIN_WIDTH, 1.0)
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,6 @@ class Violin {
basic(),
withNan(),
withGroups(),

// TODO: Move this to tests
// data132Violin(),
// data132ViolinDiscrete(),
// data132ViolinDefaultN(),
// data132ViolinIdentity(),
// data132Boxplot(),
// data123Violin(),
)
}

Expand Down Expand Up @@ -101,162 +93,4 @@ class Violin {
return HashMap(parsePlotSpec(spec))

}

private fun data132Violin(): MutableMap<String, Any> {
val spec = "{" +
" 'kind': 'plot'," +
" 'data' : {'x': [1, 3, 2]," +
" 'y': [2, 0, 1]" +
" }," +
" 'mapping': {" +
" 'x': 'x'," +
" 'y': 'y'" +
" }," +
" 'ggtitle': {" +
" 'text': 'x=[1, 3, 2]'" +
" }," +
" 'layers': [" +
" {" +
" 'geom': 'violin'," +
" 'n': 3" +
" }" +
" ]" +
"}"

return HashMap(parsePlotSpec(spec))

}

private fun data132ViolinDiscrete(): MutableMap<String, Any> {
val spec = "{" +
" 'kind': 'plot'," +
" 'data' : {'x': [1, 3, 2]," +
" 'y': [2, 0, 1]" +
" }," +
" 'mapping': {" +
" 'x': 'x'," +
" 'y': 'y'" +
" }," +
" 'ggtitle': {" +
" 'text': 'x=[1, 3, 2] and discrete'" +
" }," +
" 'layers': [" +
" {" +
" 'geom': 'violin'," +
" 'n': 3" +
" }" +
" ]," +
" 'scales': [" +
" {" +
" 'aesthetic': 'x'," +
" 'discrete': true" +
" }" +
" ]" +
"}"

return HashMap(parsePlotSpec(spec))

}

private fun data132ViolinDefaultN(): MutableMap<String, Any> {
val spec = "{" +
" 'kind': 'plot'," +
" 'data' : {'x': [1, 3, 2]," +
" 'y': [2, 0, 1]" +
" }," +
" 'mapping': {" +
" 'x': 'x'," +
" 'y': 'y'" +
" }," +
" 'ggtitle': {" +
" 'text': 'x=[1, 3, 2], default n'" +
" }," +
" 'layers': [" +
" {" +
" 'geom': 'violin'" +
" }" +
" ]" +
"}"

return HashMap(parsePlotSpec(spec))

}

private fun data132ViolinIdentity(): MutableMap<String, Any> {
val spec = "{" +
" 'kind': 'plot'," +
" 'data' : {'x': [1, 1, 1, 3, 3, 3, 2, 2, 2]," +
" 'y': [4, 3, 2, 5, 4, 3, 3, 2, 1]," +
" 'vw': [0, 1, 0, 0, 1, 0, 0, 1, 0]" +
" }," +
" 'mapping': {" +
" 'x': 'x'," +
" 'y': 'y'" +
" }," +
" 'ggtitle': {" +
" 'text': 'x=[1, 3, 2], stat=identity'" +
" }," +
" 'layers': [" +
" {" +
" 'geom': 'violin'," +
" 'mapping': {" +
" 'violinwidth': 'vw'" +
" }," +
" 'stat': 'identity'" +
" }" +
" ]" +
"}"

return HashMap(parsePlotSpec(spec))

}

private fun data132Boxplot(): MutableMap<String, Any> {
val spec = "{" +
" 'kind': 'plot'," +
" 'data' : {'x': [1, 3, 2]," +
" 'y': [2, 0, 1]" +
" }," +
" 'mapping': {" +
" 'x': 'x'," +
" 'y': 'y'" +
" }," +
" 'ggtitle': {" +
" 'text': 'x=[1, 3, 2], geom=boxplot'" +
" }," +
" 'layers': [" +
" {" +
" 'geom': 'boxplot'" +
" }" +
" ]" +
"}"

return HashMap(parsePlotSpec(spec))

}

private fun data123Violin(): MutableMap<String, Any> {
val spec = "{" +
" 'kind': 'plot'," +
" 'data' : {'x': [1, 2, 3]," +
" 'y': [2, 1, 0]" +
" }," +
" 'mapping': {" +
" 'x': 'x'," +
" 'y': 'y'" +
" }," +
" 'ggtitle': {" +
" 'text': 'x=[1, 2, 3]'" +
" }," +
" 'layers': [" +
" {" +
" 'geom': 'violin'," +
" 'n': 3" +
" }" +
" ]" +
"}"

return HashMap(parsePlotSpec(spec))

}
}
Loading