Tutorial · Beginner · 6 min
Figures for papers and slides
Pick a figure style for a journal, thesis or slide deck, adjust fonts and colours the MATLAB way, and export a PDF or SVG at the right physical size.
Choose a style
Put
style ieee(orpaper,nature,thesis,slides,poster,minimal,grayscale) at the top. The preview then shows the exact page that will be exported: 3.5 inches wide for an IEEE column, in Times. Typestylesin the console to list them all.
Try it ↗style ieee x = linspace(0, 10, 200); plot(x, exp(-x/4).*sin(2*x), x, exp(-x/4), '--') xlabel('time (s)'), ylabel('amplitude') legend('signal', 'envelope')Black and white printing
style grayscaledraws every line in black or grey and tells them apart by dash pattern, so the figure still works on a photocopier.
Try it ↗style grayscale x = linspace(0, 2*pi, 100); plot(x, sin(x), x, sin(2*x), x, sin(3*x)) legend('n = 1', 'n = 2', 'n = 3'), title('Harmonics')Fine-tune it like MATLAB
fontsize,fontname,colororder,themeandset(gca, …)work as in MATLAB.set(gcf, 'Units', 'centimeters', 'Position', [0 0 w h])sets the export size.
Try it ↗style paper bar([3 5 2 6; 4 4 3 5]') colororder('tableau'), fontsize(12), fontname('Georgia') set(gca, 'Box', 'off') set(gcf, 'Units', 'centimeters', 'Position', [0 0 12 7]) title('Results by condition')Export from the script
exportgraphics,saveasandprintput a download button under the figure. PDF and PNG use the resolution you ask for; SVG is vector. The Export menu offers the same, with size presets.
Try it ↗style nature t = linspace(0, 1, 300); plot(t, sin(2*pi*5*t).*exp(-3*t)) xlabel('t (s)'), ylabel('V') exportgraphics(gcf, 'figure1.pdf', 'Resolution', 600) exportgraphics(gcf, 'figure1.svg', 'ContentType', 'vector')Tip: For LaTeX use the PDF with \includegraphics; for Word, the 600 dpi PNG or the PDF.