r - set size of a plot area in ggplot2 -
this question has answer here:
is there way directly specify width , height of plot area ggplot2
, example 3" , 4" figure below?
sample code:
library(ggplot2) x <- seq(-5,5,by=.1) d <- data.frame(x=x,y=cos(x)) p <- ggplot(d) + aes(x=x,y=y) + geom_line() ggsave(p,file='~/example.pdf')
library(ggplot2) x <- seq(-5,5,by=.1) d <- data.frame(x=x,y=cos(x)) p <- ggplot(d) + aes(x=x,y=y) + geom_line() pdf(file="example.pdf", width=3, height=4) p dev.off()
Comments
Post a Comment