Skip to content

savefig("foo.svgz") (gzip-compressed SVG) #4916

@stevengj

Description

@stevengj

According to the docs, most of the graphical backends support SVG output, but it looks like a lot of them don't support SVGZ (which is simply gzip-compressed SVG).

Matplotlib supports SVGZ and it seems like it would be quite easy to implement similar support for any backend that supports SVG, simply by piping the SVG output through a GZipStream from GZip.jl.

For example, it seems like this works already:

using Plots, GZip
p = plot(...)
gzopen(io -> show(io, "image/svg+xml", p), "bar.svgz", "w") # save as bar.svgz

For a typical plot line plot, e.g. plot(rand(100)) or plot(rand(10^4)), I get compression ratios around 50%.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions