R Scale plot elements within PDF of set width and height -
though r plots sent pdf can rescaled @ in illustration or page layout software, scientific journals insist plots provided have specific dimensions.
can size of plotting elements scaled within given pdf size directly in r?
require(ggplot2) p <- qplot(data=iris, x=petal.width, y=petal.length, colour=species) pdf("./test_plot_default.pdf") print(p) graphics.off()
produces adequate scaling of plot elements
however, changing pdf size elements not cause plot elements scale. smaller pdfs, plotting elements overly enlarged compared plotting space.
pdf("./test_plot_dimentionsions required journal.pdf", width=3, height=3) print(p) graphics.off()
using @rosen matev suggestion:
update_geom_default("point", list(size=1)) theme_set(theme_grey(base_size=6)) pdf("./test_plot_dimentionsions required journal.pdf", width=3, height=3) print(p) graphics.off()
journals insist on having specific plot dimensions in order avoid scaling. if made, can render font size small (or large) , inconsistent figure caption font size. why plot elements (text, point size, etc.) design have same absolute size regardless of pdf size.
you can change default font size , point size, example, with:
p <- ggplot(iris, aes(x=petal.width, y=petal.length, colour=species)) + geom_point(size=1.5) + # default 2 theme_grey(base_size=10) # default 12 ggsave("test.1.pdf", p)
the defaults can changed globally, too:
update_geom_default("point", list(size=1.5)) theme_set(theme_grey(base_size=10))
Comments
Post a Comment