%useLatestDescriptors %use lets-plot //%use krangl LetsPlot.getInfo() // This prevents Krangl from loading an obsolete version of Lets-Plot classes. %use krangl val mpg_df = DataFrame.readCSV("https://raw.githubusercontent.com/JetBrains/lets-plot-kotlin/master/docs/examples/data/mpg.csv") mpg_df.head() val p = letsPlot(mpg_df.toMap()) { x = "cty"; y = "hwy"; color = "drv" } + geomPoint(tooltips = layerTooltips().line("@manufacturer @model")) // with facets val pf = p + facetGrid(y = "drv") fun themeWithFlavors( plot: org.jetbrains.letsPlot.intern.Plot, theme: org.jetbrains.letsPlot.intern.OptionsMap, themeName: String ): GGBunch { val (w, h) = 400 to 300 return gggrid( plots = listOf( plot + theme + ggtitle(themeName), plot + theme + ggtitle("flavorDarcula()") + flavorDarcula(), plot + theme + ggtitle("flavorSolarizedLight()") + flavorSolarizedLight(), plot + theme + ggtitle("flavorSolarizedDark()") + flavorSolarizedDark(), plot + theme + ggtitle("flavorHighContrastLight()") + flavorHighContrastLight(), plot + theme + ggtitle("flavorHighContrastDark()") + flavorHighContrastDark() ), ncol = 2, cellWidth = w, cellHeight = h, fit = true ) } themeWithFlavors(p, themeMinimal2(), "Minimal2") themeWithFlavors(pf, themeMinimal2(), "Minimal2 + facets") themeWithFlavors(p, themeMinimal(), "Minimal") themeWithFlavors(pf, themeMinimal(), "Minimal + facets") themeWithFlavors(p, themeClassic(), "Classic") themeWithFlavors(pf, themeClassic(), "Classic+ facets") themeWithFlavors(p, themeLight(), "Light") themeWithFlavors(pf, themeLight(), "Light + facets") themeWithFlavors(p, themeGrey(), "Grey") themeWithFlavors(pf, themeGrey(), "Grey + facets") themeWithFlavors(p, themeNone(), "None") themeWithFlavors(pf, themeNone(), "None + facets") themeWithFlavors(p, themeBW(), "BW") themeWithFlavors(pf, themeBW(), "BW + facets")