ggplot - 完整的情节区域

时间:2015-08-12 13:35:16

标签: r graphics plot ggplot2

我想保存一个情节,在情节区域周围没有任何空白。

Example of Problem

我已尝试过这段代码,但仍然在yaxis的左边有空格,在xaxis下面。

library(ggplot2)
    ggplot(data.frame(x=c(1,1,2,2),y=c(1,2,2,1)), aes(x, y)) +
    geom_polygon(fill="grey75") +
    geom_point(size=50,colour="yellow") +
    theme( 
    legend.position = "none",
    panel.background = element_blank(),
    panel.grid.major = element_blank(),
    panel.grid.minor = element_blank(),
    panel.margin = unit(0,"null"),
    plot.margin = rep(unit(0,"null"),4),
    axis.ticks = element_blank(),
    axis.text.x = element_blank(),
    axis.text.y = element_blank(),
    axis.title.x = element_blank(),
    axis.title.y = element_blank(),
    axis.ticks.length = unit(0,"null"),
    axis.ticks.margin = unit(0,"null"))+
    scale_x_continuous(expand=c(0,0)) + 
    scale_y_continuous(expand=c(0,0))][1]][1]

0 个答案:

没有答案