Returning to the Theme Defaults with flavorStandard()¶
Use flavorStandard() to override other flavors or to make defaults explicit.
InĀ [1]:
%useLatestDescriptors
%use dataframe
%use lets-plot
InĀ [2]:
LetsPlot.getInfo()
Out[2]:
Lets-Plot Kotlin API v.4.12.0. Frontend: Notebook with dynamically loaded JS. Lets-Plot JS v.4.8.1. Outputs: Web (HTML+JS), Kotlin Notebook (Swing), Static SVG (hidden)
InĀ [3]:
// Set a reusable style layer for consistent plots across the project.
LetsPlot.theme = themeClassic() +
theme(
axisTitle = elementText(size = 13),
axisText = elementText(size = 15),
axisTicksLength = 7,
panelGridMajor = elementLine(color = "spring_green"),
panelGridMinor = elementBlank()
)
.legendPositionLeft() +
flavorDarcula()
InĀ [4]:
val df = DataFrame.readCSV("https://raw.githubusercontent.com/JetBrains/lets-plot-docs/master/data/mpg.csv")
val mpg = df.toMap()
InĀ [5]:
// A base plot with the common project style
val p = letsPlot(mpg) { x = "cty"; y = "hwy"; color = "drv" } +
geomPoint(tooltips = layerTooltips().line("@manufacturer @model")) +
ggtitle("Fuel Economy: City and Highway Mileage by Drive Type")
p
Out[5]:
InĀ [6]:
// To restore the theme defaults without affecting other settings, apply flavor_standard().
// This can be useful, for example, when exporting the plot for printing.
//
// ggsave(p + flavorStandard(), filename = "plot.png", scale = 1.0)
p + flavorStandard()
Out[6]: