MATH36032 Problem Solving by Computer Publishable Quality Graphics I Raster formats: png, , tiff, , bmp, ...

I Vector formats: svg, ...

I Container formats (for special graphic softwares): (Corel Photo Paint), psd (), psp (Corel Paint Shop Pro), xcf (GIMP), ...

Different formats for different usage: jpeg/jpg for photo; gif for animation; ... Other differences: Lossy/lossless compression

Which format of figures (images) do you know? Which format of figures (images) do you know?

I Raster formats: png, jpeg, tiff, gif, bmp, ...

I Vector formats: svg, ...

I Container formats (for special graphic softwares): cpt (Corel Photo Paint), psd (Adobe PhotoShop), psp (Corel Paint Shop Pro), xcf (GIMP), ...

Different formats for different usage: jpeg/jpg for photo; gif for animation; ... Other differences: Lossy/lossless compression Raster Image vs Vector Image

Any difference between the two logos? (keep on zooming in)

Use vector images (eps,svg,...) whenever possible! Exporting jpg directly from MATLAB

x = linspace(0,5,101); plot(x,erf(x),x,airy(−5*x)) % Save as"jpg" figure What could be improved for this figure? The improved figure

1 Error Function 0.75 Airy Function

0.5

0.25 f(x)

0

−0.25

−0.5 0 1 2 3 4 5 x

More points for ”Airy Function”; increase line width; better resolution; less ticks in horizontal axis(?); extend the vertical axis (above one); legend explaining the curves; different styles for the two functions; ... Compare them together

1 Error Function 0.75 Airy Function

0.5

0.25 f(x)

0

−0.25

−0.5 0 1 2 3 4 5 x Know the names first ...

1 Error Function 0.75 Airy Function

0.5 legend

0.25 f(x)

0

−0.25

XTick

−0.5 0 1 2 3 4 5 x <− xlabel Default setting and its improvement

I Narrow line width? plot( ..., ’Linewidth’,2)

I Small font size? (gca : get current axis) set(gca,’fontsize’,18);

I Axis label xlabel(’x’,’fontsize’,14,’fontname’,’times roman’)

I Axis Tick set(gca,’XTick’,0:1:5)

I More complicated legend? lg = legend(’Error Function’,’Airy Function’); set(lg,’Position’,[0.48 0.75 0.45 0.1], ... ’box’,’off’); Finally, save the right format (for Latex)

print -depsc2 myfig.eps % c for color print -deps2 myfig.eps % for black white

I Warning: What you see on screen may not exactly be the resulting eps or file, need fine tuning of the parameters

I DO NOT print (or save) to pdf directly (will be a figure in a full A4 paper, too much unwanted space above and below the figure)

I Figures may look different on different devices (screen, printer, projector, ..) or even different viewer. In Microsoft Word, it is done differently ...

Edit Copy Figure and then Paste (or shortcut Ctrl+V). → A4 colour single-sided 21p ⊕ A4 colour double-sided (duplex) 40p ⊕

Many publications (journal articles, textbooks, ...) are still only black-white.

Color vs Black-white

University Printing Costs: A4 mono single-sided 5p ⊕ A4 mono double-sided (duplex) 8p ⊕ Color vs Black-white

University Printing Costs: A4 mono single-sided 5p ⊕ A4 mono double-sided (duplex) 8p ⊕ A4 colour single-sided 21p ⊕ A4 colour double-sided (duplex) 40p ⊕

Many publications (journal articles, textbooks, ...) are still only black-white. Color, black-white, or does not matter?

Two exactly the same figures (using print -depsc2 colorfig.eps and print -deps2 grayfig.eps)

1 1

0.8 0.8

0.6 0.6 x x

0.4 0.4

0.2 0.2

0 0 2.6 2.8 3 3.2 3.4 3.6 3.8 4 2.6 2.8 3 3.2 3.4 3.6 3.8 4 r r Which color to use?

1

0.8

0.6

0.4

0.2

0

−0.2

−0.4

−0.6

−0.8

−1 0 1 2 3 4 5 6 7 You may never use certain color(s). To differentiate different curves using line styles instead: plot(x,y1,’--’,x,y2,’-*’,x,y3,’-d’, ’MarkerSize’,6); Other : Asymptote

http://asymptote.sourceforge.net/

The footbal The Sierpinski Sponge Other vector graphics: tikz/pgf http://www.texample.net/tikz/

Editors

Pro TEXt TEX

MiKTEX pdfTEX 3

4 Systems TEX Engines 2

TEXLive X TE EX 1 5 LuaTEX Mac TEX

Formats

9

ConTEXt LATEX 6

7 8

The mindmap A complete graph Gallery made by me (using Asymptote)

p=1.25 0.1 p=1.50 p=1.80 RF p=1.95 Branch point

0 z = x + iǫ

− W(r)

Branch cut −0.1

−0.2 1 2 3 4 z = x iǫ r ρF on x RF − − | | ≤

y v w = f(z) r = r(θ)

dθ x u θ

τwk τw1 τw1 τw2

xj 1 xj xj+1 xj+2 xj+k −

z = z(x)

b

U ∞ How the source code looks like? Asymptote code for ”Football” Tikz/PGF code for ”Mindmap” import graph3; size(400); \begin{tikzpicture} currentlight.background=palegreen; \path [ dtrender=render(compression=Zero,merge=true); mindmap, text = white, real c=(1+sqrt(5))/2; level 1 concept/.append style = {font=\Large\bfseries, sibling angle=90}, triple[] x={(0,c,1),(0,-c,1),(0,-c,-1)}; level 2 concept/.append style = triple[] y={(1,0,c),(1,0,-c),(-1,0,-c)}; {font=\normalsize\bfseries}, triple[] z={(c,1,0),(-c,1,0),(-c,-1,0)}; level 3 concept/.append style = triple[][] Q= { {font=\small\bfseries}, {z[0],y[1],x[3],x[0],y[0],z[3]}, tex/.style = {concept, ball color=blue, {z[1],x[0],x[3],y[2],z[2],y[3]}, font=\Huge\bfseries}, {z[2],z[1],y[2],x[2],x[1],y[3]}, engines/.style = {concept, ball color=green!50!black}, {z[3],z[0],y[0],x[1],x[2],y[1]}, formats/.style = {concept, ball color=blue!50!black}, {x[0],x[3],z[1],y[3],y[0],z[0]}, systems/.style = {concept, ball color=red!90!black}, {x[1],x[2],z[2],y[3],y[0],z[3]}, editors/.style = {concept, ball color=orange!90!black} {x[2],x[1],z[3],y[1],y[2],z[2]}, ] {x[3],x[0],z[0],y[1],y[2],z[1]}, node [tex] {TEX} [clockwise from=0] {y[0],y[3],x[1],z[3],z[0],x[0]}, {y[1],y[2],x[2],z[3],z[0],x[3]}, child[concept color=green!50!black, nodes={engines}] { {y[2],y[1],x[3],z[1],z[2],x[2]}, node {Engines} [clockwise from=90] {y[3],y[0],x[0],z[1],z[2],x[1]} child { node {\TeX}} }; child { node {pdf\TeX}} child { node {\XeTeX}} path3 p=arc(O,Q[0][0],Q[0][1]); child { node {Lua\TeX} }} real R=abs(point(p,reltime(p,1/3))); ...... Much more complicated than a programming language! Summary

I Use vector graphics if possible

I Use the right format

I Fine tuning the parameters, and pay attention to small details

I Figures should complement your writing, and should be referred in the main text

I You can invest your time in more advanced graphics (Asymptote, Tikz/PGF, SVG,xfig,...) in the future.