开发者

Optimize the SVG output from Gnuplot

I've been trying to plot a dataset containing about 500,000 values using gnuplot. Although the plotting went well, the SVG file it produced was too large (about 25 MB) and takes ages to render. Is there some wa开发者_如何学Goy I can improve the file size?

I have vague understanding of the SVG file format and I realize that this is because SVG is a vector format and thus have to store 500,000 points individually.

I also tried Scour and re-printing the SVG without any success.


The time it takes to render you SVG file is proportional to the amount of information in it. Thus, the only way to speed up rendering is to reduce the amount of data

I think it is a little tedious to fiddle with an already generated SVG file. I would suggest to reduce the amount of data for gnuplot to plot.

Maybe every or some other reduction of data can help like splitting the data into multiple plots...


I would recommend keeping it in vector graphic format and then choosing a resolution for the document that you put it in later.

Main reason for doing this is that you might one day use that image in a poster (for example) and print it at hundreds of times the current resolution.

I normally convert my final pdf into djvu format.

pdf2djvu --dpi=600 -o my_file_600.djvu my_file.pdf

This lets me specify the resolution of the document as a whole (including the text), rather than different resolutions scattered throughout.

On the downside it does mean having a large pdf for the original document. However, this can be mitigated against if you are latex to make your original pdf - for you can use the draft option until you have finished, so that images are not imported in your day-to-day editing of the text (where rendering large images would be annoying).


Did you try printing to PDF and then convert to SVG?

In Linux, you can do that with imagemagick, which you even be able to use to reduce the size of your original SVG file.

Or there are online converters, such as http://image.online-convert.com/convert-to-svg

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜