plot_margin
parameter in theme()
allows to change the margin areas of a plot using the margin()
function.
%useLatestDescriptors
%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.
val rand = java.util.Random()
val data = mapOf("x" to List(100) { rand.nextInt(10) })
val p = letsPlot(data) { x = "x" } + geomBar() + ggtitle("Bar Сhart") +
theme(plotBackground = elementRect(size = 6))
p
p + theme(plotMargin = margin(t=20, // Top
r=10, // Right
b=10, // Bottom
l=10)) // Left