0

I'm saving a pie chart generated by ggplot with ggsave:

            pie <-ggplot(data.pie, aes(x = "", y=value, fill = target)) + 
                  geom_bar(width=1,stat="identity") +
                  coord_polar("y", start=0) +
                  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_discrete(expand=c(0,0)) + 
                  scale_y_discrete(expand=c(0,0))

        ggsave(file=filename, plot=pie, width=8, height=8)

As you may see I've tried to remove the whitespace from the generated .svg file, but without succes.

Pie chart with whitespace

The goal is to remove all of the whitespace so I can place this image on top of another image without the ugly whitespace around.

marcopah
  • 826
  • 2
  • 7
  • 25

0 Answers0