On Sat, Jul 18, 2026 at 11:25 PM Dirk Eddelbuettel <[email protected]> wrote:
>
>
> Posting to two lists at once is considered rude. Please don't do it. I
> removed r-sig-finance for this reply as there is nothing finance-specific
> here.
>
> When I want subtitles in a ggplot I rely on the existing features, for
> example arguments 'label' and 'subtitle' to sub-function ggttitle(). That
> said I do not think vertical alignment is offered by default by a theme.

I unfortunately cannot comment on ggplot directly, but if I were asked
to do the same using standard R plotting, I would use legend instead
of subtitle. The legend function has argument ncol which allows you to
specify number of columns as well as position and justification. A
simple example with a "subtitle" centered below the actual plot could
go like this:

par(mar = c(5, 3.1, 2, 1));
par(mgp = c(2, 0.7, 0));
plot(1:10, xlab = "", ylab = "x")
box = par("usr");
legend((box[1]+box[2])/2, box[3] - 2.5*strheight("M"),
   legend = c(matrix(c("A", "B", "C", "1", "2", "3"), 2, 3, byrow = TRUE)),
   pch = 1, col = rep(0, 6), ncol = 3, xpd = TRUE, bty = "n", xjust = 0.5);

I would be surprised if ggplot's legend functionality did not have a
similar level of flexibility. Or, if you don't insist on using ggplot,
you could adapt the code above. Anyway, hope this helps at least a
little.

Peter

______________________________________________
[email protected] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide https://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to