%useLatestDescriptors
%use lets-plot
%use dataframe
LetsPlot.getInfo()
Lets-Plot Kotlin API v.4.4.2. Frontend: Notebook with dynamically loaded JS. Lets-Plot JS v.4.0.0.
val 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
val p = letsPlot(df.toMap()) { x = "cty"; y = "hwy"; color = "drv" } +
geomPoint(tooltips = layerTooltips()
.title("@manufacturer @model")
.line("@|@class")
.line("@|@year")) +
labs(
title = "The plot title",
subtitle = "The plot subtitle",
caption = "The plot caption",
color = "Drive type"
)
p
// Font size and face.
val p1 = p + theme(
title = elementText(size=18),
plotTitle = elementText(face="bold"),
plotCaption = elementText(size=12, face="italic"),
axisText = elementText(size=14, face="italic"),
tooltipText = elementText(size=15)
)
p1
// Font family.
p1 + theme(text = elementText(family="Times New Roman"))