TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Right now, I create plots in the spreadsheet, copy them to OpenOffice Draw, save as images, and then put them (as images) into my .tex file.

But that leads to problems with resolution (labels too big/small), difficulties to change the graph when data changes, etc.

Is there some better way to do it?

share|improve this question
up vote 14 down vote accepted

If you need to plot a series of points in the spreadsheet you could use the pgfplots packet. First of all export your data as a csv file (Comma Separated Values). Then you can easily plot the points, I made a small example for you:


%% NB: Declare logarithmic axis 
    % Labels for the axis
    ylabel=$L_2$ error]
%% in the options you select the columns to be used as data sources
\addplot table[x=dof,y=error2,col sep=comma] {../pgftables/data.csv};

This produces as output: enter image description here

and this is the original data:

# Convergence results
# fictional source, generated 2008
share|improve this answer
That example is pretty, but can pdfplots plot all those graphs that OpenOffice can? – Rogach May 2 '12 at 10:23
You can take a look at the manual, I would say you can plot basically anything. iro.umontreal.ca/~simardr/pgfplots.pdf – gcedo May 2 '12 at 10:28

You mean you save it as a raster graphic (PNG or, iih, JPG)? You shouldn't do that. Make a PDF out of it, which should be possible with Open Office out-of-the-box. You need the diagram on a page of it's own, or better in a document of its own. Then use pdfcrop on the PDF to crop the white space around the image and include it as PDF image using \includegraphics. This will work fine with pdflatex, xelatex and lualatex. For DVI mode (latex) you can convert the PDF to EPS using several tools.

Using this way the graphic will be a vector graphic and you don't have any issues with resolution.

share|improve this answer
OpenOffice can do this by default, but (at least on 3.4) it requires manually setting the page size to that of the graph; its very difficult to get the measurement perfect. I abandoned my effort with OO.org and PDF export and just used R instead. – new123456 May 2 '12 at 11:15
@new123456: Using pdfcrop afterwards should remove all white space. – Martin Scharrer May 2 '12 at 12:34

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.