# pgfplots and final size of the externalized pdf image

I have the following piece of code:

% command: pdflatex --jobname=try-f1 try.tex
\documentclass[12pt]{book}
\usepackage{tikz,pgfplots}
\pgfrealjobname{try}
\begin{document}
\beginpgfgraphicnamed{try-f1}%
\begin{tikzpicture}
\pgfplotsset{minor grid style={color=black!20,line width=0.25pt},major grid style={color=black!30,line width=0.35pt}}
\begin{semilogyaxis}[grid=both,enlargelimits=false,scale only axis,width=6.5cm,height=4.5cm,tick style={draw=none},xticklabels={},yticklabels={},axis background/.style={fill=black!3}]
\addplot[solid] coordinates{600 points coded as (0.028,6.28386e-005) for instance}
\end{semilogyaxis}
\end{tikzpicture}
\endpgfgraphicnamed
\end{document}


the size of tex source as a text file is 12ko and 4 ko when zipped while the final pdf is 8ko. Is all this expected? I thought the final pdf would be lighter than the zipped file.

-
Why would you assume the final pdf to be smaller? It includes a lot more information than the zipped source code, so if anything I'm surprised it's not much larger. –  Jake Aug 3 '11 at 0:44
I thought pdf was somehow more efficient than zip because of destructive compression. –  pluton Aug 3 '11 at 0:55
No. For example, the PDF includes embedded fonts that is not included in the flat format TEX file. –  Werner Aug 3 '11 at 1:25
correct but in the provided example, fonts have been removed on purpose. –  pluton Aug 3 '11 at 5:03
There are macros to control the compression level of pdf. I do not have the reference at hand, but I believe the macro (for pdflatex) is \pdfcompresslevel=<integer>. Even further compression can be archived if \pdfminorversion=5 (or something like this) because a particular pdf version introduced not just stream data compression but also compression of pdf object definitions. The pgfplots manual (doc/latex/pgfplots/pgfplots.tex ) has these macros somewhere. \pdfcompresslevel=0 should result in a completely uncompressed pdf. –  Christian Feuersänger Aug 3 '11 at 7:44

There are macros to control the compression level of pdf. I do not have the reference at hand, but I believe the macro (for pdflatex) is \pdfcompresslevel=<integer>. Even further compression can be archived if \pdfminorversion=5 (or something like this) because a particular pdf version introduced not just stream data compression but also compression of pdf object definitions. The pgfplots manual (doc/latex/pgfplots/pgfplots.tex ) has these macros somewhere. \pdfcompresslevel=0 should result in a completely uncompressed pdf.