Wednesday, July 16, 2008

Steps for Creating Publication-Quality Figures Using Matlab 7 and PowerPoint (2003 edition)

As with the Excel method, my objective here is to be able to make changes
to the data or the presentation of the data without redoing huge amounts
of fiddly work or presenting figures which are no longer accurate
representations of the data. My particular goal is to never again find
myself shifting around the spacing of axis ticks and tick labels in a
graphics program by hand.

First, in Matlab:
- Get the figure looking as close to how I want it as possible. Since
Matlab figures are generated once and not linked to their data, it is best
to generate every aspect of the figure, down to fonts etc, from a script.
Ideally going all the way from the raw data spit out by your experiment
program to the nicely formatted end result. There's a command File ->
Generate M-file that could probably speed up the process of making these
scripts.

- Sizing in the ballpark of what you want in the end. Again the things
that are easily to do in powerpoint:
* Extra bits of text
* Extra graphics applied to it
* Any other tricky modifications or overlays
* Combining different figures (though if arranged in a strict grid, use of
subplot may be easier)

- Copy the figure to the clipboard in Enhanced Metafile format. Normally
Edit -> Copy Figure would do that automatically. But in most cases you
will not want to do that. As I discovered, although it is stored in a
vector format on the clipboard, the default command discards some of the
data in your figure. Specifically any more data than is needed to draw the
data at screen resolution. So if you have smoothly changing lines in your
figure that you want to print nicely, use instead this command:

print -dmeta -r600

It's exactly the same as doing Copy Figure, but only discards data below
the 600 dpi resolution. (note that exporting directly to an EMF file and
then importing seems to have this exact same problem)


Then in PowerPoint, follow most of the same steps as pasting an Excel
figure:
- Make a slideshow with 8 1/2 x 11-shaped slides, and dotted lines
indicated the maximum width for the figures

- For each figure, go to Paste Special, and choose Picture (Enhanced
Metafile). This seems to make a difference. Place the figure approximately
where it should go.

- Ungroup each (saying yes to converting to a microsoft office drawing
object), then ungroup again. For figures with multiple axes, you may have
to ungroup a third time.

- To resize the graph (while keeping all the axis ticks and tick labels in
place), select just the data area and the axis tick labels, not the axis
titles or legend, and group, then resize. I sometimes had to move around
the axis titles a bit, and for the matlab imports, sometimes the axis
tick labels.


Finally, on a test print two issues came up with both matlab and excel
generation of plots: both had lines making up the axes that were too thin,
so don't forget to change that (possibly in the source), and there was
also a hairline drawn around the entire figure (for some goddamn reason)
so make sure to ungroup and delete that box.

Tuesday, July 15, 2008

Steps for Creating Publication-Quality Figures using Excel and Powerpoint (2003 edition)

This is of fringe interest, and soon to be invalidated technology
probably, but I'm damned if I'm going to figure this out again.

First, in Excel:
- Autogenerate the figures in Excel based on my data. (use a previous
figure I made as a template if there's one that applies, that

- Important: Right click the middle of the chart, go to Format Chart Area
-> Font, and uncheck Auto scale. That way I can choose the font once,
and it won't change every time you resize the chart!

- Get it looking exactly the way I want, with the exception of:
* Extra bits of text
* Extra graphics applied to it
* Any other tricky modifications or overlays
* Sizing only in the ballpark of what it needs be. It looks like it's
actually easier to match the sizes of multiple plots to each other in
powerpoint, because you can enter in the dimensions of objects numerically.

Now in Powerpoint:
- Make a slideshow with 8 1/2 x 11-shaped slides, and dotted lines
indicated the maximum width for the figures (I'm submitting to Perception,
which uses 1.675 inch margins for figures, including all the text
associated with them.) Easiest if I put the dotted lines into a master
slide, so it automatically shows up in any new slides I create. Also a
good idea to turn on Snap objects to grid (which you can define the
spacing of), and Display grid on screen, in View -> Grid and Guides.

- Copy each figure to a separate slide from Excel, placing it
approximately where it should go

- Ungroup each (saying yes to converting to a microsoft office drawing
object), then ungroup again. This gives me the ability to fiddle with each
element of the figure individually. Moving multiple at once, and the Align
object commands are particularly handy at this point.

- To resize the graph to fit the area, select just the data area and the
axis tick labels, not the axis titles or legend, and group, then resize.
I sometimes had to move around the axis titles a bit.

Complicated! But fast once I got the hang of it, and allows for the most
important aspect of all: small changes, to the data or the formatting of
the graph, without doing everything all over again.