Making wonderful graphsIf your work is anything like mine, every once in a while you have to include a graph into a document. Where I work, everybody uses Microsoft Office with rather disastrous results. It generally goes like this:
Now then. Feel free to use Excel to tweak your data until you have the numbers that you want to graph. You can even make an Excel graph to see what things will look like, sort of. Just don't do anything else with it. Copy the numbers you want to graph into a simple text file. You can use Notepad to make the file, for instance. Leave the numbers in columns.
Easy enough. Save the file, then run Gnuplot on those numbers. The manual for Gnuplot is here: I encourage you to have a look. That said, commands typically look like this: set terminal postscript eps color "Helvetica" 14 The truth is out: we will be making a postscript file. But don't worry, it will show up in Word as well. 14 point Helvetica is the font of choice. set out "mygraph.eps" We will write to this file. Please call it something else. Now, here we go: plot "data.txt" u 1:2 t 'A' w lines lw 5,\ This plots column one against column two, and then column one against column three. The first series has legend 'A',the second 'B'. Lines are a little thicker than standard, the '5' after 'lw' tweaks that. Well, you now have a "mygraph.eps". Notice how small it is: usually around 15 kB. This is where Ghostscript comes in. Open the file using GSView (it's the program with the ghost-icon). You should see your graph in all its glory. Now we make it useful in MS Word by adding an eps-preview like so:
Adding a TIFF 6 Packbits preview makes the file around twice as large. Save the file as "newtitle.eps" (use your own imagination for the new title; remember you have to add the '.eps' yourself) and throw away the old eps-file. Now include the new file in Word the usual way: insert; picture; from file. But what's the use of all this?
But I don't like the colors!No problemo, mister. Just drag your newly minted .eps file into a text editor (before adding the TIFF preview). You should easily find these lines inside:/LT0 { PL [] 1 0 0 DL } def These define colors for lines 1 and 2. The three numbers here stand for Red, Green and Blue, and can take values between 1 (on) and 0 (off): the first line tells you that line #1 is all Red, and no Green or Blue. Change these numbers, save the file and check the result in GSview. |