Closed grantmcdermott closed 3 months ago
I kind of like this, because I'm too dumb to ever remember any of the graphics settings.
I can see that this might be nifty. However, my feeling is that this opens a whole new can of worms that might lead to "feature creep"
height
and width
and then the question is whether these should also work if we don't save
but just plot on an existing device.bg
and pointsize
, possibly res
or family
.png()
, pdf()
, svg()
, etc.tinyplot
just to save us from saying dev.off()
at the end.In short: Selecting the supported parameters is not straightforward IMO.
Thanks @zeileis, I definitely hear you on the risk of feature creep. But, motivated by the fact that I personally would find this useful, I think we can potentially strike a reasonable compromise for the most common use cases:
png
, pdf
, and svg
)res
, width
, height
, and units
defaults via tpar
(at 5, 8, "in", and 300 respectively) Let me test out a dummy version and then submit a PR for you both to look at.
OK, thanks, worth a try!
Will height
/width
/units
only be honored when plotting to one of the file devices?
Perhaps less obvious to users, but tinyplot(..., dev = NULL)
When dev is NULL
default device is used, guessed in the same way it is done for standard plot()
.
The dev
can be either device from ?Devices
, or file name with an extension from which the device will be guestimated.
Not sure if this opinion is helpful at all, but I have now incorporated this wonderful package into my main workflow, and I think adding a writing/save argument would be an amazing addition.
Many thanks for all that you do @grantmcdermott!
Hey folks, I have a PR supporting this in #143 (branch: "filename"). This is one of the last things I want to enable / decide on before CRAN submission. So please try it out and report back under the PR.
(Following on from https://github.com/grantmcdermott/tinyplot/issues/121#issuecomment-1941993963)
Something like:
or
Internally, this would need to open the appropriate graphics device based on the filename extension (here:
png()
) and calldev.off()
right at the end.We could potentially even support "in-memory" saving via
recordPlot()
if no extension is detected... although the interface might not be as clean. (Users would still have to callreplayPlot()
afterwards?)