-
Notifications
You must be signed in to change notification settings - Fork 17
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
Image truncated and white borders using gtsave() function #66
Comments
Hi @Fedess1986 and thanks for the report. Screenshots might be helpful, but it'd be even more helpful to include a reproducible example (or reprex). |
For some reason I cannot make reprex() work, anyway I did my best.
|
Also, locating the html file, what I do is:
And result is exactly the same |
Thanks for the example code @Fedess1986. I'm not surprised that I linked to the package for its helpful advice about creating a reproducible, minimal example. Are all of the packages and code in your example required to reproduce the problem? If not, it would also be helpful if you could reduce the example code to the smallest subset of packages and lines and are needed to reproduce the issue. (Often you'll find important clues in this process.) |
Thanks for the advice. I managed to rewrite the code without the "dplyr" package. Also I reduced the code by quitting many visual options that are not needed, and the issue still happens. Here is the new code. I hope this helps 😀
|
Thanks @Fedess1986, I can reproduce your issue and I have a quick solution for you.
gtsave(gt_table, filename = "test.PNG", vwidth = 1200, vheight = 1200) In general: it's pretty safe to set this to a larger value for saving a table. I'm going to leave this issue open because webshot2 should probably adapt to changes I made in rstudio/chromote#129 (for my notes see rstudio/shinytest2#367 for additional context). |
Thank you for the workaround and for the aditional info, I managed to make it work. However I want to share this too: FYI, the exported image has 1800 pixels width (zoom is default 2 so 900px * 2 is giving me those 1800 pixels, If I'm not wrong) |
@Fedess1986 Limiting the table width is also a nice approach. Note that if the table width is less than |
Thanks for your help and all your feedback. With your suggestions It's now working and covering my need. I'm also glad if this was helpful to you to help improving the library code. |
I'm trying to export a gt table created using the gtsave() function, as PNG file.
The generated PNG has some white border at the left, and sometime at botton and top too. Also, the right side of the image is cropped/truncated.
The gtsave() generates a html temp file to get the shot, which I can locate and check the table looks correct (I open that html file with chrome).
I tryed changing and playing vwidth, vheight, zoom, expand, and selector arguments, with no luck.
I can upload some screenshots for references, if needed
The text was updated successfully, but these errors were encountered: