%useLatestDescriptors %use lets-plot %use dataframe LetsPlot.getInfo() val df = DataFrame.readCSV("https://raw.githubusercontent.com/JetBrains/lets-plot-kotlin/master/docs/examples/data/mpg.csv") df.head(3) val p = letsPlot(df.toMap()) { x = "displ"; y = "hwy" } + geomPoint() + labs( title = "Fuel efficiency\nfor most popular models of car", subtitle = "Period 1999-2008", caption = "MPG Dataset", x = "Engine displacement\n(litres)", y = "Highway\nmiles per gallon" ) + themeClassic() + theme(plotBackground = elementRect(size=1)) p // Change margins around plot title, subtitle, caption and axis titles p + theme(plotTitle = elementText(margin = margin(t=15)), plotSubtitle = elementText(margin = margin(b=10)), plotCaption = elementText(margin = margin(b=15)), axisTitleX = elementText(margin = margin(t=10)), axisTitleY = elementText(margin = margin(r=10, l=15))) // Change margins around axis tick labels p + theme(axisTextX = elementText(margin = margin(t=10, b=15)), axisTextY = elementText(margin = margin(r=10, l=15))) // axis labels at different levels val p2 = letsPlot(df.toMap()) { x = "class"; y = "hwy" } + geomBoxplot() p2 p2 + theme(axisTextX = elementText(margin = margin(t=10, b=10))) // with rotation val p3 = p2 + ggsize(550, 400) p3 p3 + theme(axisTextX = elementText(margin = margin(t=10)))