Centre the title of ggplot


with the above link suggestions, I have tried both
theme(plot.title = element_text(hjust = 0.5)) 

and

ggeasy::easy_center_title()

It works perfectly inside RStudio, however when deployed inside Shiny Server, its title always go the left. Any specific reason? Could the reason that I have too many overlapping plots?

  gg <- ggplot(data = DF_3.0) + 
          geom_histogram(aes(x = cal0_grade), breaks = bins_grade, fill = "yellow", alpha = 0.2) + 
          geom_histogram(data = DF_3.1, aes(x = cal1_grade), breaks = bins_grade, fill = "red", alpha = 0.2) +
          geom_histogram(data = DF_3.2, aes(x = cal2_grade), breaks = bins_grade, fill = "blue", alpha = 0.2) +
          geom_histogram(data = DF_3.3, aes(x = cal3_grade), breaks = bins_grade, fill = "green", alpha = 0.2) +
          scale_y_log10(breaks = trans_breaks("log10", function(x) 10^x),
                        labels = trans_format("log10", scales::math_format(10^.x))) +
          ggtitle(title3) + theme(plot.title = element_text(hjust = 0.5)) + 
          xlab("%")+ ylab("count (log)") 

But why inside RStudio its title is centred, but in Shiny Server, it is to the left?

This topic was automatically closed 21 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.