[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #58001] to big size of svg

From: Michael Leitner
Subject: [Octave-bug-tracker] [bug #58001] to big size of svg
Date: Tue, 17 Mar 2020 04:06:52 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0

Follow-up Comment #1, bug #58001 (project octave):

The data vector you pass to the plot command has 5 million points. If the
resulting file has 78 MB, this means you have about 16 bytes per point: a
space, a comma, two decimal points, leaves you 6 significant digits per
coordinate. This is very reasonable. 

On the other hand, the matlab file (which seems to have only 15.9 kB on my
side) has first used the most aggressive white space, comma, and leading zero
elimination conceivable (I hadn't known that svg allows that, but it really
does) making it quite hard to read and a small nightmare to parse the points
back (I really do that sometimes). I don't know if I think that a good idea,
but in any case this would give you savings on the order of 25%. No, matlab
has also decided that you need only one data point per quarter of a nominal
pixel horizontal distance (where your figure is 560 pixels wide) apart from
the vertical maxima and minima, and has deleted all points in between. You
could have achieved exactly the same result (apart from the whitespace ...
elimination mentioned above) by two lines of preprocessing your data:

find(y(2:end-1)<y(3:end)&y(2:end-1)<=y(1:end-2))+1 (1:2500:length(y))]);

gives me a 34.2 kB file. And very probably there are free online out there
that you can pass your svg files to and that remove redundant data points,
optimally even with a specified tolerance. But I would not want such a thing
to happen automatically -- is there an option to turn this off, or is it
impossible in matlab to generate an svg file with the exact nodes that you


Reply to this item at:


  Message sent via Savannah

reply via email to

[Prev in Thread] Current Thread [Next in Thread]