clear; % create a signal x = linspace(0, 4*pi, 100).'; y = sin(x); figure; % white figure background set(gcf, 'Color', [1, 1, 1]); % figure size and aspect ratio set(gcf, 'Position', [300 300 400 300]); % plot y plot(x/pi, y, 'Linewidth', 2, 'Color', [.7 .7 .7]); % light gray color grid on; box on; xlim([-.5 4.5]); ylim([-1.2 1.2]); xlabel('$x / \pi$' , 'interpreter', 'latex', 'Fontsize', 16); ylabel('$\sin(x)$' , 'interpreter', 'latex', 'Fontsize', 16); % export a bitmap of the figure print('sine.png','-dpng', '-painters', '-r600'); % This command should be fine, too: %print('sine.png','-dpng', '-opengl', '-r600');