extend ggplot_image() to other output formats
Open
@rich-iannone is already working on this.
Since Jun 18, 2025.
Type: ★ Enhancement
- Dominant language
- R
- Stars
- 2.2k
- Forks
- 225
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 11
Description
Prework
- Read and abide by gt's code of conduct and contributing guidelines.
- Search for duplicates among the existing issues (both open and closed).
Thanks for all the work you've done on this package :)
Proposal
Currently ggplot_image() only works for HTML since it uses local_image(). If it were updated to use fmt_image() functionality then ggplots within gt outputs could go to other formats more easily.
library(ggplot2)
library(gt)
library(dplyr)
plot_object <- ggplot(data = mtcars, mapping = aes(x = mpg, y = cyl)) +
geom_point()
filename <- "temp_ggplot.png"
# Save PNG file to disk
ggplot2::ggsave(
filename = filename,
plot = plot_object,
device = "png",
dpi = 100,
width = 5,
height = 5
)
gt <- tibble(filename) |>
gt() |>
fmt_image(columns = everything(), sep = ",", width = "6in")
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.