r-lib / marquee

Markdown Parser and Renderer for R Graphics
https://marquee.r-lib.org
Other
82 stars 1 forks source link

margins change when adding element_marquee to plot titles #27

Closed davidhodge931 closed 3 months ago

davidhodge931 commented 3 months ago
library(tidyverse)
library(palmerpenguins)
library(marquee)

p1 <- penguins |>
  ggplot() +
  geom_histogram(aes(x = bill_depth_mm)) +
  labs(
    title = "Pygoscelis penguin bill depths",
    subtitle = "Adelie, Chinstrap, and Gentoo species",
  ) 

p2 <- p1 + 
  theme(plot.title = marquee::element_marquee()) +
  theme(plot.subtitle = marquee::element_marquee())

p1

p2
image image
thomasp85 commented 3 months ago

I think this is fixed in dev. I did some tweaks to the margin collapsing based on similar feedback

davidhodge931 commented 3 months ago

Thanks! Dev version margins look really good :)