Markdown can be used in titles only and is disabled by default. To enable it, set elementMarkdown()
for the appropriate element in theme()
.
Currently supported features:
*
, **
, ***
, _
, __
, ___
)<span style='color:red'>text</span>
)<a href="https://lets-plot.org">Lets-Plot</a>
)\n
)Not supported features:
<br/>
for line splitting[Lets-Plot](https://lets-plot.org)
)%useLatestDescriptors
%use dataframe
%use lets-plot
val df = DataFrame.readCSV("https://raw.githubusercontent.com/JetBrains/lets-plot-docs/master/data/mpg.csv")
df.remove("Unnamed: 0")
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 |
letsPlot(df.toMap()) +
geomPoint(size=8) { x="displ"; y="cty"; color="drv" } +
scaleColorManual(listOf("#66c2a5", "#fc8d62", "#8da0cb"), guide="none") +
// Enable Markdown in all titles
theme(title=elementMarkdown()) +
// Adjust style of title and subtitle
theme(plotTitle=elementText(size=30, family="Georgia", hjust=0.5),
plotSubtitle=elementText(family="Georgia", hjust=0.5)) +
labs(
// Span styling, mixing style and emphasis
title=
"""<span style="color:#66c2a5">**Forward**</span>, """ +
"""<span style="color:#8da0cb">**Rear**</span> and """ +
"""<span style="color:#fc8d62">**4WD**</span> Drivetrain""",
// Simple emphasis
subtitle="**City milage** *vs* **displacement**",
// multiline caption, multiline style span, links
caption="<span style='color:grey'>" +
"Powered by <a href='https://lets-plot.org'>Lets-Plot</a>. \n" +
"Visit the <a href='https://github.com/jetbrains/lets-plot/issues'>issue tracker</a> for feedback." +
"</span>",
// Axis titles
x="Displacement (***inches***)",
y="Miles per gallon (***cty***)"
)