I have a LaTeX file (compiled with pdflatex
) with some images in pdf added via the \includegraphics
command. The problem is that the images are really big (up to 10MB) and the output file is too large (more than 30MB).
The images have been obtained via the splot
command in gnuplot
but there are a lot of points in the splot.
I have tried to get the images in other formats (.jpg
, .png
basically) since the file size is considerably lower and thus the size of my resulting .pdf
is also lower. But when I include this files in my LaTeX document the images lose a lot of quality (even though they have OK quality when viewed separately).
How could I get a small pdf file from pdflatex
without sacrificing too much quality on the images? I suppose that the problem lies in resizing the image from the pdf-latex but can't solve it. Or in other words, how can I obtain smaller .pdf
images (or other format accepted by pdflatex
) without losing too much quality when added to the pdf file?
The LaTeX command is \includegraphics[width=7cm]{file.pdf}
. Note that I have to resize them to fit 7cm width.
EDIT:
I add 4 files (original images in .pdf
, .png
and .jpeg
and resulting pdf
file compiled with pdflatex
. Here's the latex code too.
\documentclass[a4paper,10pt]{article}
\usepackage[utf8x]{inputenc}
\usepackage[pdftex]{graphicx}
\begin{document}
\begin{figure}
\centering
\includegraphics[width=7cm]{numeric.pdf}
\caption{Pdf file.}
\end{figure}
\begin{figure}
\centering
\includegraphics[width=7cm]{numeric.png}
\caption{Png file.}
\end{figure}
\begin{figure}
\centering
\includegraphics[width=7cm]{numeric.jpeg}
\caption{Jpeg file.}
\end{figure}
\end{document}
Best Answer
I get really good quality saving my files as
eps
with a dpi setting of 1000 in Python. With this setting, I can zoom in at the highest level and there is no loss of quality with the lines.I don't know if there is a way for you to set the dpi in gnuplot. If you can't, make the plot in Python or do it in tikz/pgf-plots.
If you want to check the quality, check out this post I have on code review and run the code.
python optimize ode solving
Edit:
Here is a link to download the files they look better then the google doc output (this isn't the same image the code link produces just the first two I could find the fastest).
converted to pdf
eps
Edit 2:
Here is your data in a pdf compiled in latex(an image of it at least). I deleted the first line that said x, t, u from the datagrid file.
Code: Open ipython with the alias
ipython --pylab=qt
Here are selection options I like: Accent, gist_rainbow, jet, and Paired.
To save it in a rotate form, you need:
ax.view_init(elev=elevation_angle, azim=azimuthal_angle)
and add in the angle changes which the plot will show you on the bottom as you rotate it.Edit 3:
From my understanding of reading the
gnuplot
manual onset hidden3d
,set hidden3d
hides portion of the plot that wouldn't be viewable from certain angles since in real life we can't see through the object. This by default how the plot is viewed in python. You can't see everything and will obtain different views by rotating the plot. Therefore, I don't think there is anything that needs to be set to accomplish this goal.