I am trying to export pdf figures with the export_fig function, but it is cropping away the title. it is doing a nice cropping job at the other axis but not the north one. Anyone had this issue? My code is
t = 0:0.01:10;
s1 = 0.7*sin(6*t) + sin(9*t) + 2*sin(14*t);
plot(t,s1,'LineWidth',0.5)
xlabel('Time[s]')
ylabel('y(t)')
title('This is a title')
set(gca,'FontSize',16);
export_fig( './sinewaves', '-pdf','-transparent')
The above code produces this figure
I know I can '-nocrop': export_fig( './sinewaves', '-pdf','-transparent','-nocrop')
to get the title back, but then it is not cropped on the west and east axis, like below
Anyone have a solution around this? Thanks for any comments!
Solved this by upgrading to MATLAB 2020a and using function:
exportgraphics(gcf,'./sinewaves.pdf','ContentType','vector')