%useLatestDescriptors
%use dataframe
%use lets-plot
LetsPlot.getInfo()
Lets-Plot Kotlin API v.4.9.0. Frontend: Notebook with dynamically loaded JS. Lets-Plot JS v.4.5.1.
var df = DataFrame.readCSV("https://raw.githubusercontent.com/JetBrains/lets-plot-kotlin/master/docs/examples/data/mpg.csv")
df.head(3)
DataFrame: rowsCount = 3, columnsCount = 12
untitled | manufacturer | model | displ | year | cyl | trans | drv | cty | hwy | fl | class |
---|---|---|---|---|---|---|---|---|---|---|---|
1 | audi | a4 | 1.800000 | 1999 | 4 | auto(l5) | f | 18 | 29 | p | compact |
2 | audi | a4 | 1.800000 | 1999 | 4 | manual(m5) | f | 21 | 29 | p | compact |
3 | audi | a4 | 2.000000 | 2008 | 4 | manual(m6) | f | 20 | 31 | p | compact |
val p = ggplot(df.toMap()) + geomPoint {x = "cty"; y = "hwy"}
gggrid(
plots = listOf(
p + ggtitle("themeMinimal2() - the default"),
p + ggtitle("themeGrey()") + themeGrey(),
p + ggtitle("themeBW()") + themeBW(),
p + ggtitle("themeLight()") + themeLight(),
p + ggtitle("themeClassic()") + themeClassic(),
p + ggtitle("themeMinimal()") + themeMinimal(),
),
ncol = 2,
cellWidth = 400,
cellHeight = 300,
vGap = 0,
fit = true
)
val pf = p + facetGrid(x = "drv")
gggrid(
plots = listOf(
pf + ggtitle("themeMinimal2() - the default"),
pf + ggtitle("themeGrey()") + themeGrey(),
pf + ggtitle("themeBW()") + themeBW(),
pf + ggtitle("themeLight()") + themeLight(),
pf + ggtitle("themeClassic()") + themeClassic(),
pf + ggtitle("themeMinimal()") + themeMinimal(),
),
ncol = 1,
cellWidth = 700,
cellHeight = 200,
vGap = 0,
fit = true
)