wilkelab / ggtext

Improved text rendering support for ggplot2
https://wilkelab.org/ggtext/
GNU General Public License v2.0
655 stars 37 forks source link

Vertical alignment of the box surrounding the figure title text #69

Closed gulinan closed 3 years ago

gulinan commented 3 years ago

Hi,

In the following reproducible example, I would like to move the surrounding box of figure title down, specifically, to the center of the figure. I tried our several positive/negative values of vertical adjustment, namely, vjust, however it did not work out. I wonder what I am missing here. I would really appreciate your suggestion.


Brief description of the problem or desired feature.

library(ggplot2)
library(ggtext)

data <- data.frame(
  name=c("A","B","C","D","E") ,
  value=c(3,12,5,18,45)
)

ggplot(data, aes(x=name, y=value, fill = "name")) +
  geom_col()+
  ggtitle("Figure Title <br><b><i>Comes Here </b></i>")+
  theme(plot.title.position = "panel",
        plot.title = element_textbox_simple(width = grid::unit(1.2, "in"),
                                            fill = "black",
                                            size = 12, 
                                            color ="blue", 
                                            halign = 0.5, 
                                            hjust  = 0.5, 
                                            vjust  = -10) ))

Rplot

clauswilke commented 3 years ago

Please ask these types of questions on stackoverflow or the RStudio community.