USAID-OHA-SI / glitr

SI graphics package to adorn your ggplots
https://usaid-oha-si.github.io/glitr/
Other
27 stars 4 forks source link

Extra space in title #54

Open achafetz opened 3 years ago

achafetz commented 3 years ago

With the newest version of glitr, I'm seeing a gap between the top of the page and the title, which didn't exist before. I doubt it would be a result of theme(plot.title.position = "plot") which should just move the title left, now down.

New image

Old image

achafetz commented 3 years ago

Running the following code, plot.title.position = "plot" doesn't move the title down, just left, so it's something funky with si_style

library(tidyverse)
library(palmerpenguins)
library(glitr)
library(extrafont)
library(glue)

#Base plot
penguins %>% 
  ggplot(aes(flipper_length_mm, bill_length_mm, color = species)) +
  geom_point() +
  labs(x = "Flipper Length (mm)",
       y = "Bill Length (mm)",
       title = "BASE PLOT",
       subtitle = "An informative subtitle",
       caption = "Horst AM, Hill AP, Gorman KB (2020). palmerpenguins: Palmer Archipelago (Antarctica) penguin data.")

#include plot.title.position = "plot"

penguins %>% 
  ggplot(aes(flipper_length_mm, bill_length_mm, color = species)) +
  geom_point() +
  labs(x = "Flipper Length (mm)",
       y = "Bill Length (mm)",
       title = "plot.title.position = 'plot'",
       subtitle = "An informative subtitle",
       caption = "Horst AM, Hill AP, Gorman KB (2020). palmerpenguins: Palmer Archipelago (Antarctica) penguin data.") +
  theme(plot.title.position = "plot")

#si_style

penguins %>% 
  ggplot(aes(flipper_length_mm, bill_length_mm, color = species)) +
  geom_point() +
  labs(x = "Flipper Length (mm)",
       y = "Bill Length (mm)",
       title = "plot.title.position = 'plot'",
       subtitle = "An informative subtitle",
       caption = "Horst AM, Hill AP, Gorman KB (2020). palmerpenguins: Palmer Archipelago (Antarctica) penguin data.") +
  si_style()