Ggplot title move left

Hi,

I've been trying to move the plot title left but unsuccessfuly. I have hjust at 0 and I've tried negative values of margin. What other methor would you recommend?

fik <- structure(list( pocet_pracovniku = c(3, 3, 1, 3, 2.348, 1.85, 4.0626,3.2036, 2.2649, 1, 1.4, 3.6601, 1.6448, 2.75, 2.4128, 2, 2.875,  2.5, 3.875, 4.6667),   
                       kraj = structure(c(9L,9L, 9L, 9L, 9L, 9L, 4L, 4L, 4L, 4L, 1L, 1L, 1L, 14L, 14L, 14L,14L, 14L, 14L, 14L),
                                        .Label = c("Moravskoslezsk├Ż", "Zl├şnsk├Ż",  "Olomouck├Ż", "Jihomoravsk├Ż", "Vyso─Źina", "Pardubick├Ż", "Kr├ílov├ęhradeck├Ż",  "Libereck├Ż", "├Üsteck├Ż", "Karlovarsk├Ż", "Plze┼łsk├Ż", "Jiho─Źesk├Ż", "St┼Öedo─Źesk├Ż", "Praha"),
                                        class = "factor")), row.names = c(NA, -20L), class = c("tbl_df", "tbl", "data.frame"))

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
library(ggplot2) 

plot <- ggplot(fik, aes(y = kraj, x = pocet_pracovniku, fill = "#ECB925", 
                        group = kraj)) +
  geom_boxplot(outlier.alpha = 0.1) +
  scale_fill_manual(values = c("#ECB925")) +
  theme_minimal() +
  theme(legend.position = 'none',
        legend.title = element_blank(),
        text = element_text(size = 15, family = "Fira Sans Condensed"),
        plot.title = element_text(margin = margin(0,0,10,-20), 
                                  hjust = 0),
        axis.title.x = element_blank(),
        axis.title.y = element_blank(),
        panel.spacing = unit(2, "lines"),
        panel.grid.major.x = element_blank(),
        
  ) +
  scale_x_continuous(label = scales::comma_format(accuracy = 1,
                                                  scale = 1,
                                                  prefix = "",
                                                  suffix = "",
                                                  big.mark = " ",
                                                  decimal.mark = ","),
                     limits = c(0,8)) +
  ggtitle("Pr┼»m─Ťrn├Ż po─Źet provozn├şch zam─Ťstnanc┼» ve ve┼Öejn├Żch M┼á")

plot

image

many thanks,

Jakub

Add these arguments to the theme:

theme(
   plot.title.position = "plot", 
   plot.caption.position =  "plot"
)
1 Like

Many thanks, it works. But what does it do?