grantmcdermott · GitHub

Thanks, again, Grant. I'm still afraid that it will turn into a can of worms but I also agree that this is a nifty feature that I will use myself. Some comments:

  • Inches: Defaulting to inches might make people angry but it's what they also have to do everywhere else (e.g., in knitr, quarto, etc.).

  • Default height/width: I'm not sure whether a non-square default is the best choice. In base R but also in knitr etc. the defaults are (almost?) all square. So that would feel most natural - and least surprising - to me.

  • Setting height/width: I agree that I will use this all the time, so setting it conveniently would be a big plus. Maybe it's worth making these standard arguments? This might be useful for interactive plotting on the screen as well. For example

    tinyplot(Petal.Length ~ Petal.Width | Species, data = iris, facet = "by", height = 4.5, width = 12)
    

    could internally call

    dev.new(height = 4.5, width = 12)
    tinyplot(Petal.Length ~ Petal.Width | Species, data = iris, facet = "by")
    
  • Supported devices: I think we should add jpeg() to the list of supported devices for file extensions .jpg and .jpeg. This is easily available in base R and might be useful in some contexts (e.g., when I quickly want to get something without transparency).

  • Calling png: I would change line https://github.com/grantmcdermott/tinyplot/blob/filename/R/tinyplot.R#L460 as follows:

    png = png(filepath, width = filewidth, height = fileheight, res = fileres, units = "in"),
    

    The resulting file will be the same but I think that the code is more readable and more similar to the other devices.

Read the original on github.com ↗