Large file size when saving ggplot to svg

499 views
Skip to first unread message

Jonas K

unread,
Nov 20, 2015, 3:58:20 AM11/20/15
to ggplot2
Dear all,

I want to save a multiple panel plot with 9 subplot each with ~ 7000 data points to *.svg using ggsave or via RStudio-Button. However, the svg-files are relatively large ~ 9 MB. Is their any possibility to reduce the size of the file?

I presume the large size is because of the many data points (a lot of them are overlapping) so maybe it is possible to exclude overlapping points from plotting?

The same thing occurs in these example (many data point a lot of the overlapping), here the svg-file is ~13MB

data(diamonds)

A <- ggplot(diamonds, aes(x=table, y=carat))+
  geom_point()+
  stat_smooth(size=1.5, se=FALSE)
 
ggsave(A, file="A.svg")

Thanks.
 

romunov

unread,
Nov 20, 2015, 4:00:27 AM11/20/15
to Jonas K, ggplot2

Hi,

you will have to "manually" remove the ovrrlapping points or use a raster format.

Cheers,
Roman

--
--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example: https://github.com/hadley/devtools/wiki/Reproducibility
 
To post: email ggp...@googlegroups.com
To unsubscribe: email ggplot2+u...@googlegroups.com
More options: http://groups.google.com/group/ggplot2

---
You received this message because you are subscribed to the Google Groups "ggplot2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ggplot2+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Susanne Oberhauser-Hirschoff

unread,
Nov 21, 2015, 10:29:19 AM11/21/15
to ggplot2
On Fri, Nov 20, 2015 at 9:58 AM Jonas K <franc...@gmx.de> wrote:
I want to save a multiple panel plot with 9 subplot each with ~ 7000 data points to *.svg using ggsave or via RStudio-Button. However, the svg-files are relatively large ~ 9 MB. Is their any possibility to reduce the size of the file?

have you considered to compress the file with gzip compression?

that might just do it depending on what you use the svg for.


S.


Reply all
Reply to author
Forward
0 new messages