The plot_title_position and plot_caption_position parameters set the alignment of the plot title/subtitle and caption.
A value of "panel" (the default) means that titles/caption are aligned with the plot panel. A value of "plot" means that titles/caption are aligned to the entire plot, excluding margins.
import pandas as pd
from lets_plot import *
LetsPlot.setup_html()
mpg_df = pd.read_csv("https://raw.githubusercontent.com/JetBrains/lets-plot-docs/master/data/mpg.csv")
mpg_df.head(3)
p = ggplot(mpg_df) + \
geom_point(aes(x='displ', y='cty', color='drv')) + \
labs(title = "Title of the plot",
subtitle = "Subtitle of the plot",
caption = "Caption of the plot")
By default titles and caption are aligned with the plot panel:
p
The position can be set relative to the entire plot using the plot_title_position and plot_caption_position parameters of the theme function:
p + theme(plot_title_position='plot', plot_caption_position='plot')