How can I put the Y axis title from where it is to the red box?
If I use this command it goes to the left of the 20.
axis.title.y = element_text(angle = 0, hjust = 1)
How can I put the Y axis title from where it is to the red box?
If I use this command it goes to the left of the 20.
axis.title.y = element_text(angle = 0, hjust = 1)
When I am not mistaken, the easiest way to solve it is by moving the y_axis text to the (sub) title area of the plot. Here is an example. Adjust hjust
to a value that suit your needs (I could not check the range myself owing to limitations of my mobile)
library(ggplot2)
ggplot(mtcars, aes(x=hp, y=mpg)) + geom_point() +
ggtitle("mpg") +
theme(
axis.title.y = element_blank(),
plot.title = element_text(hjust=0))
Hope this helps,
JW
I used the subtitle to solve the problem using the following code:
theme(plot.subtitle=element_text(hjust = -0.09))
You can adjust the position using different values in hjust
.
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
If you have a query related to it or one of the replies, start a new topic and refer back with a link.