davidgohel / rvg

https://davidgohel.github.io/rvg/
132 stars 15 forks source link

Suggestion: take ggplot2 object as alternative to code in ph_with_rv #16

Closed md0u80c9 closed 7 years ago

md0u80c9 commented 7 years ago

Hi,

Just a very quick suggestion. I wonder whether as an alternative for the ‘code’ parameter it would be possible to accept ggplot2 objects (or other plot objects).

The main benefit for this is that instead of having to draw the chart inline, you can render the plots in separate functions and then pass them to the PowerPoint renderer.

moodymudskipper commented 7 years ago

I came to say the same thing.

Meanwhile it's possible to use code=plot(my_ggplot), instead of code = my_ggplot but making the function recognise the input as a ggplot object would shorten the code and prevent some future head scratches from users.

md0u80c9 commented 7 years ago

Yes that is exactly what I do in my code, but it makes it more readable and idiot-proofed if the function checks the object type and performs the plot if needed.

davidgohel commented 7 years ago

OK.

argument ggobj has been added.