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

wrap_table() removes gt::fmt_markdown() #402

Open
jack-davison opened this issue Oct 15, 2024 · 2 comments
Open

wrap_table() removes gt::fmt_markdown() #402

jack-davison opened this issue Oct 15, 2024 · 2 comments

Comments

@jack-davison
Copy link

jack-davison commented Oct 15, 2024

gt version 0.11.0

patchwork version 1.3.0


reprex:

gt <- data.frame(x = "ug m<sup>-3</sup>") |> gt::gt() |> gt::fmt_markdown()

gt

image

patchwork::wrap_table(gt)

image


I wasn't sure if a) this was a known issue and b) whether there's a workaround to get subscripts/superscripts/etc. in a "wrapped table" in a patchwork assembly?

Cheers!

(I don't know if I should cc @teunbrand as I know you worked on gt grob outputs!)

@teunbrand
Copy link
Contributor

R graphics doesn't really support markdown or html formatting out of the box, so I'm afraid you're hitting the limitations of the graphics system.
You can swap out the text generating function, but I think there currently is no easy way to forward this from within {patchwork}.

gt <- data.frame(x = "ug m<sup>-3</sup>") |> gt::gt()
plot(gt::as_gtable(gt, text_grob = gridtext::richtext_grob))

Created on 2024-10-15 with reprex v2.1.1

@jack-davison
Copy link
Author

Thanks - that makes sense to me!

plot(gt::as_gtable(gt, text_grob = gridtext::richtext_grob))

This actually does the job for my use-case as I don't necessarily need the other nice patchwork things (e.g., table header alignment with "space" etc.), just to stick a small table to a plot.

Happy to mark as closed if this is an impossible/unlikely to be achieved thing for patchwork.

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

2 participants