-
Notifications
You must be signed in to change notification settings - Fork 2
New function for saving ggplots with default parameters #76
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
base: main
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
AstroRobin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the default for the path parameter be NULL or '.', the former is consistent with the default for ggsave? Note, I do see the reason to not have path = NULL because it is required to create the directory before saving plots. Perhaps instead, we should set the default to path='.', which avoids creating a directory unless explicitly asked for by the user.
Also for defaults, I feel like 'full landscape' will be the most common default for plots over 'full portrait'. I think the documentation should list all the possible layouts.
device documentation should list 'pdf' and 'png' — or even the full list provided in ggsave(). Technically ggsave() accepts device as either a string or alternatively as a device object like png(). I wonder if force converting device to character will break certain use cases. Counter argument to the above is that the png(...) like function also accept things like width and height, which may break the current layout in thekids_save.
if '.png' or '.pdf' are included in the filename, then the output file will look something like "test.pdf_fill_portrait.pdf". Can use tools::file_ext() and tools::file_path_sans_ext() to get the components separated.
On the point of adding e.g. '_full_portrait' to the end of output filenames, I feel like this is only useful if multiple formats are requested simultaneously (likely not the most common use case). So I suggest that if only a single output is being saved, just behave like the typical ggplot() save without adding the specifics of the layout.
Could save_params be renamed to layout_params or similar? To me save_params sounds like a function used to save parameters. Not precious about this, so happy to ignore.
Not really sure if this is just my machine, but I get errors when trying to save in 'pdf':
thekids_save(filename='testing.pdf')
Saving to: output/testing_full_portrait.pdf
Error in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
invalid font type
The plot, although saving, does not have any labels.
|
Interesting re labels being omitted from plots... I cannot seem to reproduce this on my machine (where Barlow is installed) nor on my VM (where Barlow is not installed). Changes (running tab)
Further Thinking RequiredOmitting
|
Fixes #65