[pstricks] optimizing final eps figure size with pst-func

mathias legrand legrand.mathias at gmail.com
Thu Feb 11 18:11:58 CET 2010


Hi all,

here is the suggestion which is not very important. It looks like the 
final size in Kb of
an eps figure depends on the number of digits in the coding.

For instance, compare this :

\documentclass[12pt]{article}
\usepackage{pstricks,pst-all}
\begin{document}
\thispagestyle{empty}
\savedata{\mydataD}[
{  0.0,  0.0},
{  0.1,  0.2},
{  0.2,  0.3},
{  0.3,  0.5},
{  0.4,  0.6},
{  0.5,  0.7},
{  0.6,  0.8},
{  0.7,  0.8},
{  0.8,  0.8},
{  0.9,  0.7},
{  1.0,  0.7},
{  1.1,  0.6},
{  1.2,  0.5},
{  1.3,  0.4},
{  1.4,  0.3},
{  1.5,  0.2},
{  1.6,  0.2},
{  1.7,  0.1},
{  1.8,  0.1},
{  1.9,  0.0},
{  2.0,  0.0},
{  2.1,  0.0},
{  2.2,  0.0},
{  2.3,  0.0},
{  2.4,  0.0},
{  2.5,  0.0},
{  2.6,  0.0},
{  2.7,  0.0},
{  2.8,  0.0},
{  2.9,  0.0},
{  3.0,  0.0},
{  3.1,  0.0},
{  3.2,  0.0},
{  3.3,  0.0},
{  3.4,  0.0},
{  3.5,  0.0},
{  3.6,  0.0},
{  3.7,  0.0},
{  3.8,  0.0},
{  3.9,  0.0},
{  4.0,  0.0},
{  4.1,  0.0},
{  4.2,  0.0},
{  4.3,  0.0},
{  4.4,  0.0},
{  4.5,  0.0},
{  4.6,  0.0},
{  4.8,  0.0},
{  4.9,  0.0},
{  5.0,  0.0}]
\begin{figure}[h!]\centering\scriptsize
\psset{yunit=6cm,xunit=1.5}
\begin{pspicture}(0,-0.11)(5,1.1)
\dataplot[linewidth=1.5p]{\mydataD}
\end{pspicture}
\end{figure}
\end{document}

to :


\documentclass[12pt]{article}
\usepackage{pstricks,pst-all}
\begin{document}
\thispagestyle{empty}
\savedata{\mydataD}[
{  0.0000000000000002,  0.0000000000000001},
{  0.1000000000000002,  0.2019676900000001},
{  0.2000000000000002,  0.3915127000000001},
{  0.3100000000000002,  0.5574770900000001},
{  0.4100000000000002,  0.6910534600000001},
{  0.5100000000000002,  0.7865448800000001},
{  0.6100000000000002,  0.8417101600000001},
{  0.7100000000000002,  0.8576757700000001},
{  0.8200000000000002,  0.8384648100000001},
{  0.9200000000000002,  0.7902474000000001},
{  1.0200000000000002,  0.7204473600000001},
{  1.1200000000000002,  0.6368433000000001},
{  1.2200000000000002,  0.5467827000000001},
{  1.3300000000000002,  0.4565900600000001},
{  1.4300000000000002,  0.3712074500000001},
{  1.5300000000000002,  0.2940637100000001},
{  1.6300000000000002,  0.2271368700000001},
{  1.7300000000000002,  0.1711551700000001},
{  1.8400000000000002,  0.1258760300000001},
{  1.9400000000000002,  0.0903877300000001},
{  2.0400000000000002,  0.0633909500000001},
{  2.1400000000000002,  0.0434324000000001},
{  2.2400000000000002,  0.0290784000000001},
{  2.3500000000000002,  0.0190276400000001},
{  2.4500000000000002,  0.0121712000000001},
{  2.5500000000000002,  0.0076117300000001},
{  2.6500000000000002,  0.0046547200000001},
{  2.7600000000000002,  0.0027836700000001},
{  2.8600000000000002,  0.0016281700000001},
{  2.9600000000000002,  0.0009315100000001},
{  3.0600000000000002,  0.0005213300000001},
{  3.1600000000000002,  0.0002854400000001},
{  3.2700000000000002,  0.0001529000000001},
{  3.3700000000000002,  0.0000801400000001},
{  3.4700000000000002,  0.0000411000000001},
{  3.5700000000000002,  0.0000206300000001},
{  3.6700000000000002,  0.0000101300000001},
{  3.7800000000000002,  0.0000048700000001},
{  3.8800000000000002,  0.0000022900000001},
{  3.9800000000000002,  0.0000010500000001},
{  4.0800000000000002,  0.0000004700000001},
{  4.1800000000000002,  0.0000002100000001},
{  4.2900000000000002,  0.0000000900000001},
{  4.3900000000000002,  0.0000000400000001},
{  4.4900000000000002,  0.0000000200000001},
{  4.5900000000000002,  0.0000000100000001},
{  4.6900000000000002,  0.0000000000000001},
{  4.8000000000000002,  0.0000000000000001},
{  4.9000000000000002,  0.0000000000000001},
{  5.0000000000000002,  0.0000000000000001}]
\begin{figure}[h!]\centering\scriptsize
\psset{yunit=6cm,xunit=1.5}
\begin{pspicture}(0,-0.11)(5,1.1)
\dataplot[linewidth=1.5pt,plotstyle=curve]{\mydataD}
\end{pspicture}
\end{figure}
\end{document}

The figures are not exactly the same due to truncation but it is just 
for the sake of illustration.

The final eps size after an eps2eps clean up is:
image 1: 4373 bytes
image 2: 4689 bytes

The difference is not obvious but for some figures where the number of 
plotted points is more important,
it can lead to a non-negligible difference. My request is then: for all 
the pst-func functions, would it be possible
to add an optional parameter controlling the number of digits in the 
coding of the final eps?
Something like:

\psWeibull[alpha=2,beta=1,plotpoints=1000,digits=3]{0}{5}

if it does not exit already...

Thank you,

M.
















More information about the PSTricks mailing list