% make_example_fig.m Example research figure (MATLAB or GNU Octave). % % EXAMPLE DATA. The numbers below are made up to show the house style. % Replace them with a source-backed series and name the source in the % LaTeX caption. % % Writes example_fig_matlab.pdf (vector, for LaTeX) and example_fig_matlab.png. % Run: matlab -batch "run('figures/make_example_fig.m')" % or octave --no-gui figures/make_example_fig.m set(0, 'defaultfigurevisible', 'off'); OUT = fileparts(mfilename('fullpath')); if isempty(OUT), OUT = pwd; end % Cool-lane palette (brand site Cool tokens) INK = [16 21 28]/255; % #10151C NAVY = [11 22 34]/255; % #0B1622 SKY = [197 212 226]/255; % #C5D4E2 CYAN = [78 195 224]/255; % #4EC3E0 one highlight only MUTED = [90 101 114]/255; % #5A6572 LINE = [205 213 221]/255; % #CDD5DD % EXAMPLE DATA (not real) t = 1:12; seriesA = [10 11 13 12 14 16 17 17 19 20 22 23]; seriesB = [ 9 9 10 11 11 12 12 13 13 14 14 15]; fig = figure('visible', 'off', 'color', [1 1 1], 'paperunits', 'inches', ... 'papersize', [6.2 3.4], 'paperposition', [0 0 6.2 3.4]); ax = axes('parent', fig, 'color', [1 1 1]); hold(ax, 'on'); for yv = [10 15 20] plot(ax, [0.5 12.5], [yv yv], '-', 'color', LINE, 'linewidth', 0.5); end h1 = plot(ax, t, seriesA, '-o', 'color', NAVY, 'linewidth', 1.4, ... 'markerfacecolor', NAVY, 'markersize', 4); h2 = plot(ax, t, seriesB, '-o', 'color', SKY, 'linewidth', 1.4, ... 'markerfacecolor', SKY, 'markersize', 4); plot(ax, t(end), seriesA(end), 'o', 'color', CYAN, ... 'markerfacecolor', CYAN, 'markersize', 6); set(ax, 'fontsize', 8, 'fontname', 'Times', 'xcolor', INK, 'ycolor', INK, ... 'linewidth', 0.6, 'tickdir', 'out', 'box', 'off', ... 'xlim', [0.5 12.5], 'ylim', [5 27], 'xtick', 1:12); xlabel(ax, 'Month', 'fontsize', 9, 'color', INK, 'fontname', 'Times'); ylabel(ax, 'Value (units)', 'fontsize', 9, 'color', INK, 'fontname', 'Times'); legend(ax, [h1 h2], {'Series A', 'Series B'}, 'location', 'northwest', ... 'box', 'off', 'fontsize', 8, 'textcolor', INK, 'fontname', 'Times'); text(12.4, 6, 'EXAMPLE DATA', 'fontsize', 7, 'color', MUTED, ... 'horizontalalignment', 'right', 'fontname', 'Times', 'parent', ax); print(fig, fullfile(OUT, 'example_fig_matlab.pdf'), '-dpdf', '-color'); print(fig, fullfile(OUT, 'example_fig_matlab.png'), '-dpng', '-r150'); close(fig); disp('wrote example_fig_matlab.pdf, example_fig_matlab.png');