Archive for September 10th, 2010

Writing a report, part 1 : graphs

In the following posts, I will explain the basics of LaTeX and other tips in order to write a report. My purpose is to be able to write any kind of report related to humanities. That’s why you shouldn’t expect to see any kind of particular tips or hack, just the basics for beginners.

In this post I will focus my explanation on graphics. Indeed in humanities, history for example, you will be likely to have to insert graphics in your report, thesis, slides and so on. To create these graphs, I use plotdrop. Plotdrop is a minimal and simple frontend to Gnuplot, useful when you have a list of figures.

I will consider the following example to explain how we use this software. Let’s consider you have the following figures :

#Tableau des prix moyens nationaux annuels de l’hectolitre de froment par année civile de 1726 à 1790
#
#année  prix moyens de l’hectolitre (en livres tournois)

1726          11.33
1727          9.23
1728          8.19
1729          9.05
1730          9.07
1731          9.38
1732          8.28
1733          8.07
1734          8.25
1735          8.11
1736          9.03
1737          9.42
1738          10.33
1739          11.36
1740          12.25
1741        14.18
1742          10.69
1743          7.82
1744          7.57
1745          7.62
1746          9.39
1747          12.04
1748          13.72
1749          12.46
1750          11.49
1751          11.67
1752          13.25
1753          11.85
1754          11.17
1755          8.54
1756          9.58
1757          11.89
1758          11.27
1759          11.76
1760          11.77
1761          10
1762          9.91
1763          9.53
1764          10.01
1765          11.16
1766          13.27
1767          14.32
1768         15.51
1769         15.38
1770          18.82
1771         18.16
1772         16.65
1773         16.44
1774         14.57
1775         15.89
1776         12.91
1777         13.36
1778          14.67
1779         13.59
1780          12.59
1781          13.45
1782          15.26
1783          15.02
1784         15.33
1785         14.83
1786         14.13
1787         14.16
1788          16.09
1789          21.92
1790          19.45

These figures show average national annual price of the hectoliter of wheat from 1726 until 1790, the French Revolution. Everything which is after the “#” is ignored, so if you want to write comments or make a quick description of your file, use “#”. Also, notice that there is a space between years (x axis) and price (y axis). I use the tab key to easily put this space and clarify my file.

I have saved this figures in a file named “example.txt”. Notice the extension, “.txt”. Nothing complicated at all, which means that if you use Windows, you can use notepad, available for free since it is the default text editor for Windows. In Mac OS X, you can use TextEdit, see in your Applications folder. If you use Linux or FreeBSD, you have plenty of choices. You can use Gedit, Kate, Kwrite, GVim, Emacs, etc. But if you are unfamiliar with Linux, then use gedit in Ubuntu, it is simple. Here is a screenshot :

Second, we have our figures, we want to get our graph. Then we use plotdrop. If you use Ubuntu, then install it with synaptic :

Once you have Plotdrop installed, then open it. If you don’t know where it is located in your menu, then press Alt+F2, type “Plotdrop”, and press Enter. Here is how plotdrop looks like :

Open up you file manager (Nautilus, Pcmanfm, Thunar, Dolphin depending on your system) and select the file in your file manager, and drop it in Plotdrop. Then push the button “Plot”. That’s all folks ! Here is a picture of the output I get with my file example.txt :

Notice that the default layout of your graph can be changed in the options of Plotdrop, see in “Appearance” and then “Line style”. Next, when you are satisfied of the output you get, save it. For this, see the menu, Plot, and Plot to file :

As you will see, Plotdrop is useful and easy to use. If you want to use other software, remember the name Gnuplot. This program has several frontends. Search these with Synaptic, or any other package manager in Linux, or take a look at this link : http://www.gnuplot.info/links.html