Howto Write a Thesis using LaTeX: Export Scalable Graphs from Excel to Inkscape

The trick with creating nice looking and scalable graphs is the same as discussed in Howto Write a Thesis using LaTeX: Generate Resolution Independent Figures Using Inkscape. Instead of saving the graph as ‘common’ image, meaning as bitmap, jpeg or png, graphs should also be generated as vector graphics.

Unfortunately, Excel does not provide an obvious way to export graphs as vector graphics (at least, I do not know any). But, fortunately, there is a little workaround which I will describe in this little tutorial.

First, assume we have some data present in an Excel sheet and generated any plot from the data. In the example below, I put in some data from the top of my head (without any scientific verification!) on how probable it is to went totally crazy, formatting your hard drive, destroy all your lab equipment and move to any abbey in Tibet for the rest of your live dependent on the amount of time you spend already to prepare your thesis.
PFreakingOut

To export this nice and somehow scary graph from Excel and to import it in our LaTeX document, we first need to select the graph by clicking on it, you should see a border around the figure. Note that it is important to select the figure only as we just want to export the graph and not the whole document!

Next, we select File->Save As … from the context menu and save it as PDF! See the screenshot below (Sorry, my installation of Excel is German)

PFreakingOutSaveAsPDF

That’s all that needs to be done in Excel. Actually, we would be easily able to import the PDF just generated into our LaTeX document, but there is some beautification needed which is best to be done with Inkscape.

To do so, we first open Inkscape and select File->Open (do NOT use Import!) from the context menu. Browse to the recently generated PDF file and press the Open button.
OpenGraphInInkscape

It might take a few seconds until the next dialogue should pop up. Do not touch any configuration at the import dialogue, simply press OK. The graph may be placed like that:
GraphImported

Note that the imported graph behaves like it would have been created with Inkscape meaning that you can easily click elements, remove or edit them. I personally do not like the grey border around the graph, so I remove it by clicking the border and removing it. You might want to change the colour, axis titles, font size or whatever…

Next, we go to File->Document Properties… to set the page size to fit the graph with some spacing of 10px.
Inkscape_resize_to_content

Last, we save the plot as PDF file by selecting File->Save as from the context menu.
Remind that you need to select PDF as file type. That’s it, we just created a resolution independent scalable graph with Excel and Inkscape. Of course, this PDF can be included in our LaTeX document in the same way as any other image, namely by writing:

A scary and maybe exaggerated Graph is shown in Figure ??.
\begin{figure}[ht]
	\centering
    \includegraphics[width=0.5\textwidth]{fig/FreakingOut.pdf}
    \caption[Short caption]{Detailed caption}
    \label{fig:imageGraph}
\end{figure}

Also, the graphicx package should be added to the preamble of the Thesis.tex file:

\usepackage{graphicx}
Warning: count(): Parameter must be an array or an object that implements Countable in /customers/5/e/0/torsten-schoen.de/httpd.www/wp-includes/class-wp-comment-query.php on line 399

3 thoughts on “Howto Write a Thesis using LaTeX: Export Scalable Graphs from Excel to Inkscape

  1. Pingback: Howto write a thesis using LaTeX, Part 3: Tips and Tricks | Torsten SchönTorsten Schön

  2. Thanks this tutorial was extraordinary helpful. It’s really a shame that even in 2017 Microsoft Excel still doesn’t offer proper support for exporting graphs into vector formats on their own.

Leave a Reply

Your email address will not be published. Required fields are marked *