Upload
others
View
3
Download
0
Embed Size (px)
Citation preview
MATH36032 Problem Solving by Computer
Publishable Quality Graphics
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 graphicsoftwares): cpt (Corel Photo Paint), psd (AdobePhotoShop), psp (Corel Paint Shop Pro), xcf(GIMP), ...
Different formats for different usage: jpeg/jpg for photo; giffor animation; ...
Other differences: Lossy/lossless compression
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 graphicsoftwares): cpt (Corel Photo Paint), psd (AdobePhotoShop), psp (Corel Paint Shop Pro), xcf(GIMP), ...
Different formats for different usage: jpeg/jpg for photo; giffor 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
0 1 2 3 4 5−0.5
−0.25
0
0.25
0.5
0.75
1
x
f(x)
Error FunctionAiry Function
More points for ”Airy Function”; increase line width; betterresolution; less ticks in horizontal axis(?); extend the vertical axis(above one); legend explaining the curves; different styles for thetwo functions; ...
Compare them together
0 1 2 3 4 5−0.5
−0.25
0
0.25
0.5
0.75
1
xf(
x)
Error FunctionAiry Function
Know the names first ...
0 1 2 3 4 5−0.5
−0.25
0
0.25
0.5
0.75
1
x
f(x)
<− xlabel
XTick
legend
Error FunctionAiry Function
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 labelxlabel(’x’,’fontsize’,14,’fontname’,’times
roman’)
I Axis Tickset(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 colorprint -deps2 myfig.eps % for black white
I Warning: What you see on screen may not exactly be theresulting eps or pdf file, need fine tuning of the parameters
I DO NOT print (or save) to pdf directly (will be a figure in afull A4 paper, too much unwanted space above and below thefigure)
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).
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 onlyblack-white.
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 onlyblack-white.
Color, black-white, or does not matter?
Two exactly the same figures (using print -depsc2
colorfig.eps and print -deps2 grayfig.eps)
2.6 2.8 3 3.2 3.4 3.6 3.8 40
0.2
0.4
0.6
0.8
1
r
x
2.6 2.8 3 3.2 3.4 3.6 3.8 40
0.2
0.4
0.6
0.8
1
r
x
Which color to use?
0 1 2 3 4 5 6 7−1
−0.8
−0.6
−0.4
−0.2
0
0.2
0.4
0.6
0.8
1
You may never use certain color(s). To differentiate differentcurves using line styles instead:plot(x,y1,’--’,x,y2,’-*’,x,y3,’-d’, ’MarkerSize’,6);
Other vector graphics: Asymptote
http://asymptote.sourceforge.net/
The footbal The Sierpinski Sponge
Other vector graphics: tikz/pgfhttp://www.texample.net/tikz/
TEX Engines
TEX
pdfTEX
X ETEX
LuaTEX
Formats
LATEXConTEXt
Systems
TEXLive
MacTEX
MiKTEX
ProTEXt
Editors
1
2
3
4
5
6
78
9
The mindmap A complete graph
Gallery made by me (using Asymptote)
Branch cut
z = −x + iǫ
z = −x− iǫ
Branch point
1 2 3 4−0.2
−0.1
0
0.1
r
W(r)
p=1.25p=1.50p=1.80p=1.95
RF
ρF on |x| ≤ RF
x
y
u
v
w = f(z)r = r(θ)
dθ
θ
xj xj+1xj−1 xj+2 xj+k
τw1 τw1τw2
τwk
U∞
z = z(x)
b
How the source code looks like?Asymptote code for ”Football”
import graph3;
size(400);
currentlight.background=palegreen;
dtrender=render(compression=Zero,merge=true);
real c=(1+sqrt(5))/2;
triple[] x={(0,c,1),(0,-c,1),(0,-c,-1)};triple[] y={(1,0,c),(1,0,-c),(-1,0,-c)};triple[] z={(c,1,0),(-c,1,0),(-c,-1,0)};triple[][] Q= {
{z[0],y[1],x[3],x[0],y[0],z[3]},{z[1],x[0],x[3],y[2],z[2],y[3]},{z[2],z[1],y[2],x[2],x[1],y[3]},{z[3],z[0],y[0],x[1],x[2],y[1]},{x[0],x[3],z[1],y[3],y[0],z[0]},{x[1],x[2],z[2],y[3],y[0],z[3]},{x[2],x[1],z[3],y[1],y[2],z[2]},{x[3],x[0],z[0],y[1],y[2],z[1]},{y[0],y[3],x[1],z[3],z[0],x[0]},{y[1],y[2],x[2],z[3],z[0],x[3]},{y[2],y[1],x[3],z[1],z[2],x[2]},{y[3],y[0],x[0],z[1],z[2],x[1]}
};path3 p=arc(O,Q[0][0],Q[0][1]);
real R=abs(point(p,reltime(p,1/3)));
.
.
.
Tikz/PGF code for ”Mindmap”
\begin{tikzpicture}\path [
mindmap, text = white,
level 1 concept/.append style =
{font=\Large\bfseries, sibling angle=90},level 2 concept/.append style =
{font=\normalsize\bfseries},level 3 concept/.append style =
{font=\small\bfseries},tex/.style = {concept, ball color=blue,
font=\Huge\bfseries},engines/.style = {concept, ball color=green!50!black},formats/.style = {concept, ball color=blue!50!black},systems/.style = {concept, ball color=red!90!black},editors/.style = {concept, ball color=orange!90!black}
]
node [tex] {TEX} [clockwise from=0]
child[concept color=green!50!black, nodes={engines}] {node {Engines} [clockwise from=90]
child { node {\TeX} }child { node {pdf\TeX} }child { node {\XeTeX} }child { node {Lua\TeX} }}
.
.
.
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 bereferred in the main text
I You can invest your time in more advanced graphics(Asymptote, Tikz/PGF, SVG,xfig,...) in the future.