## LaTeX forum ⇒ Graphics, Figures & Tables ⇒ TikZ surface plot file size Topic is solved

Information and discussion about graphics, figures & tables in LaTeX documents.
h4mmk
Posts: 2
Joined: Thu Sep 07, 2017 3:58 pm

### TikZ surface plot file size

Hi, I am plotting three-dimensional surfaces using pgfplots. An example follows.

1. \documentclass{standalone}
2. \usepackage{pgfplots}
3. \pgfplotsset{compat=1.14}
4.
5.
6. \begin{document}
7. \begin{tikzpicture}
8. \begin{axis}[view={20}{10},axis lines=none,xmin=-15, xmax=15,ymin=-15, ymax=15,zmin=-1, zmax=4]
9.
11. fill opacity=1,
12. draw opacity=1,
14. colormap={outside}{color=(blue!40) color=(blue)},
15. point meta=-abs(x),
16. mesh/interior colormap={inside}{color=(red!40) color=(red)},
17. domain=0.01:15,
18. y domain=0:2*pi,
19. samples=30
20. ]
21. ({x*cos(deg(y))},{x*sin(deg(y))},{sqrt(x)});
22.
23. \end{axis}
24. \end{tikzpicture}
25. \end{document}

When I compile this code with PDFLaTeX, the resulting PDF document is 900KB. I have many such surfaces in the master file that I am working on, so it has a huge file size. I can reduce the size of each surface by reducing the number 30 in "samples=30", but quality suffers.

My question, then, is whether anyone has advice on how my code could be adjusted to drastically reduce the size of the files, but retain the quality. Too much to ask for, perhaps, but any suggestions on this subject will be appreciated nonetheless! Thank you very much.

Tags:

Stefan Kottwitz
Posts: 9569
Joined: Mon Mar 10, 2008 9:44 pm
PDF compression could be used, such as, for example:

1. \pdfminorversion=5
2. \pdfcompresslevel=9
3. \pdfobjcompresslevel=3

Either for the single plot and include it as pdf image, or for the whole document. Another option would be compression by Ghostscript.

Stefan

h4mmk
Posts: 2
Joined: Thu Sep 07, 2017 3:58 pm