0

I used the code in the end of this question to plot and save a gt table. Now I am facing a problem that the top, bottom, left and right edges of the table are too compact (the space is too small). In my actual data plotted table, the last column is even out the area of the table.

enter image description here

Thus I want to add more margin space (increase the area between the two blue boxes as figure below shows) to the four edges of the table.

How can I achieve this? Maybe I'm missing some parameters, but I didn't find the right ones in tab_options(). Thanks.

library(gt)
p <- mtcars %>% 
  select(cyl:wt) %>% 
  head() %>% 
  gt()

gtsave(p, file='test.png', vwidth=1000, vheight=600, zoom=1)

Out:

enter image description here

ah bon
  • 9,293
  • 12
  • 65
  • 148
  • The example you provided doesn't seem to be representative of the problem you're experiencing, at least how I am understanding it. Are you exporting your actual table as a png and is the first photo an example of what that looks like exactly? If so, the issue would be with the exporting, not with the table options. – Abigail Nov 04 '22 at 18:59
  • Thanks for your comment, I think this case is similar to `plot.margin` function in `ggplot2`. Please refer to https://stackoverflow.com/questions/10836843/ggplot2-plot-area-margins. – ah bon Nov 06 '22 at 11:11

0 Answers0