Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Putting a boundary around marquee_grob #51

Closed
petermott opened this issue Jan 26, 2025 · 1 comment
Closed

Putting a boundary around marquee_grob #51

petermott opened this issue Jan 26, 2025 · 1 comment

Comments

@petermott
Copy link

I want to add a marquee_grob to a rmarkdown document using RStudio, but on its own, not as part of anything bigger. The problem is I don't know how to set the grob to fit around the text. Here is an example:

library(patchwork)
library(marquee)
library(ggplot2)
text  <-  "
 ```stan_glm
  family:       binomial [logit]
  formula:      switch ~ dist100
  observations: 3020
  predictors:   2
 ------
             Median MAD_SD
 (Intercept)  0.61   0.06 
 dist100     -0.62   0.10 
 
 ------
 * For help interpreting the printed output see ?print.stanreg
 * For info on the priors used see ?prior_summary.stanreg```"

grob <- marquee_grob(text,
                     force_body_margin = TRUE,
                     style = modify_style(classic_style(base_size=12), "cb", lineheight=1),
                     )
g = wrap_elements(panel=grob)
ggsave("a_grob.png", g)

The problem is the text sits at the top of a much deeper frame. How do I trim the frame to fit the text and nothing more?

@petermott
Copy link
Author

I can no longer reproduce this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant