Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #135 #144

Merged
merged 3 commits into from
May 22, 2020
Merged
Changes from 1 commit
Commits
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
Next Next commit
Demo with issue
  • Loading branch information
IKupriyanov-HORIS committed May 19, 2020
commit 1f6a294c57acb07cc59d4377ee5573566b69c3da
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,72 @@ import jetbrains.datalore.plotDemo.model.PlotConfigDemoBase
class AsDiscrete : PlotConfigDemoBase() {
fun plotSpecList(): List<Map<String, Any>> {
return listOf(
plotData_DiscreteGroup(),
fillFactor(),
fillAndColorFactor(),
fillFactorWithScaleColor(),
layerData_DiscreteGroup(),
smoothStatAsDiscrete(),
smoothStatWithGroup()
missingScale()
// plotData_DiscreteGroup(),
// fillFactor(),
// fillAndColorFactor(),
// fillFactorWithScaleColor(),
// layerData_DiscreteGroup(),
// smoothStatAsDiscrete(),
// smoothStatWithGroup()
)
}

private fun missingScale(): Map<String, Any> {
val spec = """
{
"data": {
"Unnamed: 0": [220, 56, 60, 208, 226, 11, 120, 144, 187, 59, 234, 146, 112, 90, 106, 38, 73, 230, 117, 96],
"manufacturer": ["volkswagen", "dodge", "dodge", "volkswagen", "volkswagen", "audi", "hyundai", "nissan", "toyota", "dodge", "volkswagen", "nissan", "hyundai", "ford", "honda", "dodge", "dodge", "volkswagen", "hyundai", "ford"],
"model": ["jetta", "dakota pickup 4wd", "durango 4wd", "gti", "new beetle", "a4 quattro", "tiburon", "altima", "camry solara", "durango 4wd", "passat", "altima", "sonata", "f150 pickup 4wd", "civic", "caravan 2wd", "ram 1500 pickup 4wd", "passat", "tiburon", "mustang"],
"displ": [2.8, 5.2, 4.7, 2.0, 2.5, 2.0, 2.7, 2.5, 2.2, 4.7, 3.6, 3.5, 2.4, 5.4, 1.8, 2.4, 5.7, 2.0, 2.0, 4.6],
"year": [1999, 1999, 2008, 1999, 2008, 2008, 2008, 2008, 1999, 2008, 2008, 2008, 2008, 2008, 2008, 1999, 2008, 2008, 1999, 1999],
"cyl": [6, 8, 8, 4, 5, 4, 6, 4, 4, 8, 6, 6, 4, 8, 4, 4, 8, 4, 4, 8],
"trans": [ "auto(l4)", "manual(m5)", "auto(l5)", "manual(m5)", "manual(m5)", "auto(s6)", "auto(l4)", "auto(av)", "auto(l4)", "auto(l5)", "auto(s6)", "manual(m6)", "manual(m5)", "auto(l4)", "auto(l5)", "auto(l3)", "auto(l5)", "auto(s6)", "manual(m5)", "manual(m5)"],
"drv": [ "f", "4", "4", "f", "f", "4", "f", "f", "f", "4", "f", "f", "f", "4", "f", "f", "4", "f", "f", "r"],
"cty": [ 16, 11, 9, 21, 20, 19, 17, 23, 21, 13, 17, 19, 21, 13, 25, 18, 13, 19, 19, 15],
"hwy": [ 23, 17, 12, 29, 28, 27, 24, 31, 27, 17, 26, 27, 31, 17, 36, 24, 17, 28, 29, 22],
"fl": [ "r", "r", "e", "r", "r", "p", "r", "r", "r", "r", "p", "p", "r", "r", "r", "r", "r", "p", "r", "r"],
"class": [ "compact", "pickup", "suv", "compact", "subcompact", "compact", "subcompact", "midsize", "compact", "suv", "midsize", "midsize", "midsize", "pickup", "subcompact", "minivan", "pickup", "midsize", "subcompact", "subcompact"]
},
"mapping": {
"x": "displ",
"y": "hwy"
},
"kind": "plot",
"layers": [
{
"geom": "point",
"mapping": {
"color": "cyl"
}
},
{
"geom": "smooth",
"mapping": {
"color": "cyl"
},
"data_meta": {
"mapping_annotations": [
{
"aes": "color",
"annotation": "as_discrete",
"parameters": {
"label": "cyl"
}
}
]
},
"method": "lm",
"deg": 2,
"size": 1
}
]
}
""".trimIndent()
return parsePlotSpec(spec)
}

private val data = """{
|"x": [0, 5, 10, 15],
|"y": [0, 5, 10, 15],
Expand Down