Bar graph name in ggplot2

Asked

Viewed 748 times

2

I made this chart with geom_bar(), would like the title (a) followed the direction of ylab, but I’m not getting it.

I used this function parameter geom_bar()

theme(plot.title = element_text(hjust = 0, size = 13))

with this result:

inserir a descrição da imagem aqui

would like the title to be aligned with the ylab, as follows:

inserir a descrição da imagem aqui

How to proceed? using the hjust = 0, hoped that the title would already align with the margin of ylab, but it doesn’t, I tried negative values too and I couldn’t.

1 answer

2


The values of hjust can be negative for you to do what you need.

For example:

library(ggplot2)

ggplot(iris, aes(x = Species)) +
  geom_bar() +
  ggtitle("Titulo") + 
  theme(plot.title = element_text(hjust = -0.07, size = 13))

inserir a descrição da imagem aqui

  • Simple myth, thank you.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.