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

test plot default pdf size

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() 

enter image description here

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() 

enter image description here

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

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -