Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to right-justify a main title of a base (hist) plot in R?

Tags:

plot

r

I'm trying to get the title of a plot to align to the right-most part of the plot.

To clarify, in the example to follow, the title of the plot is aligned to the center.

op <- par(mfrow=c(2, 2))
hist(islands)
utils::str(hist(islands, col="gray", labels = TRUE))
like image 579
Atticus29 Avatar asked Dec 02 '25 02:12

Atticus29


1 Answers

Use separate function for the main title and graphical parameter adj:

op <- par(mfrow=c(2, 2))
hist(islands,main=NULL)
title("Histogram of islands",adj=1)
utils::str(hist(islands, col="gray", labels = TRUE,main=NULL))
title("Histogram of islands",adj=1)
like image 57
Jouni Helske Avatar answered Dec 04 '25 22:12

Jouni Helske