Reputation: 4116
I am trying to do some precise layout and positioning of elements in a few ggplots for publication.
My current workflow of ggplot2, ggsave, load and view is quite annoying.
Is it possible to setup the plot viewer in RStudio to give the same layout as in my ggsave? I would need font sizes and other size-related options to be reproduced.
For reference, most of my plots are ggsave("fig1.png", width=8.85, height=x, units="cm", dpi=600)
The heights depend on what I'm putting together.
Else, are there any good packages for producing nice sized plots for publications? ie no extra whitespace, scaling plots to fit allocated size...
Upvotes: 3
Views: 506
Reputation: 4116
The command you want is
windows(width=8 /2.54, height=10 /2.54, xpinch=96, ypinch=96)
That opens a window, based on 96dpi, 8 cm wide and 10 cm high. Inside that, you can then work with the various layout tools within ggplot
or whatever library you're using to get the actual layout you want. You may need to tweak linewidths/pointsizes due to the difference in monitor resolution and print resolution, but it is not too bad.
Upvotes: 0