Multiline subtitle

Andre Luiz Tietbohl Ramos <[email protected]> Sat, 18 Jul 2026 12:05:07 -0300
Newsgroups gmane.comp.lang.r.r-metrics,gmane.comp.lang.r.general
Message-ID <CAPZA_qJ=--_jXtw6ERzHhamCFP85SZdXHUf1irJVps=hqE=D3A@mail.gmail.com>
Hello,

Suppose I want to have a multiline subtitle using ggplot() with aligned
strings between first line and second line like a table.  I'm using the
approach below to no avail,

tickers.subtitle <- c("CPFE3.SA",  "CXSE3.SA", " ALUP11.SA",  "BBAS3.SA",  "
CMIG4.SA",  "VALE3.SA", " LEVE3.SA", "VIVT3.SA", "TAEE4.SA", "RANI3.SA", "
BRSR6.SA", "SAPR4.SA")
ticker.subtitle.weights <- c("20.0%",   "15.0%",  "15.0%",  "5.0%", "5.0%",
"5.7%", "5.7%", "5.7%", "5.7%", "5.7%", "5.7%", "5.7%")

port_cumulative_ret %>% ggplot(aes(x =3D date, y =3D cum_ret)) +
...
labs(
...
subtitle =3D paste('Ativos: ', tickers.subtitle,
                          '\nPesos: ', ticker.subtitle.weights)
)

Any suggestions?

TIA,

--
Andr=C3=A9 Luiz Tietbohl Ramos, PhD

	[[alternative HTML version deleted]]