MATLAB only prints a part of my figure
- by simonty
I'm trying to print my figure in Matlab, but it keeps screwing up and I have no idea why.
opslaan = figure(1);
plot(1:handles.aantal,handles.nauw,'-r','LineWidth',1.5);
xlabel(gca,sprintf('Framenummer (%g ms per frame)',60/handles.aantal));
ylabel(gca,'dB');
set(gca,'YGrid','on');
yAsMax = ceil( ceil(max(handles.nauw)) / 2) * 2;
axis([0 handles.aantal 0 yAsMax]);
pause(1);
print -dpng image.png
The first line is just plotting the data on my figure, then labeling x and y, turning on grid and caculating the y-axis like I want it. This all works great and Matlab shows it like I want it in the Figure window. When saving to .png / .jpeg / .eps it goes wrong and only prints the bottom left corner (473x355 pixels), the rest just disappeared.
When exporting manually via File - Save As, it works correctly.
Any help?
Thanks!