Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function [] = save2pdf_TMAG3(fig_handle, ax_handle, fileName)
- dir_Tikz = 'C:\Antti\Matlab\General Useful Stuff\Matlab2Tikz';
- dir_MikTex = 'C:\Antti\MikTex portable\miktex\bin';
- name_tex = 'makefigure_tmag_1a';
- %trying to set legend position
- l_handle = findall(fig_handle,'Type','legend');
- if ~isempty(l_handle)
- lPos = l_handle.Position(1:2);
- axPos = ax_handle.Position(1:2);
- axL = ax_handle.Position(3:4);
- lPos = (lPos - axPos)./(axL);
- Lpos = [', at={(' num2str(lPos(1)) ',' num2str(lPos(2)) ')}, anchor=south west'];
- else
- Lpos = [];
- end
- %axis label sizes; legend position
- extraaxisoptions = ['xlabel style={font=\footnotesize},'...
- 'ylabel style={font=\footnotesize},',...
- 'legend style={font=\small' Lpos '},',...
- 'ticklabel style={font=\scriptsize}'];
- matlab2tikz('figurehandle', fig_handle, [dir_Tikz '\texfig.tex'], 'showinfo', false, 'width', '3.5in', 'extraaxisoptions', extraaxisoptions);
- %compiling
- dirStr = ['cd "' dir_Tikz '"'];
- compileStr = ['"' dir_MikTex '\xelatex" -quiet "' dir_Tikz '\' name_tex '"'];
- system([dirStr ' & ' compileStr]);
- %copying figure to destination
- copyfile([dir_Tikz '\' name_tex '.pdf'], fileName);
- end
Advertisement
Add Comment
Please, Sign In to add comment