Why are the top and bottom parts of my MATLAB figure cropped when I use SAVEAS to save a figure to a PNG-file?
31 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Why are the top and bottom parts of my MATLAB figure cropped when I use SAVEAS to save a figure to a PNG-file?
When I try to save my figure to a PNG-file using SAVEAS, the top and bottom parts of the image are cutoff. However, when I use SAVEAS to save my figure to a BMP-file, the figure appears just fine. If I use PRINT instead of SAVEAS, the cropping occurs for either file format. For example:
figure;
set(gcf,'position',[0 0 1000 800]);
axes('fontsize',28);
title('Title');
xlabel('X Axis');
saveas(gcf,'tmp','png');
saveas(gcf,'tmp','bmp');
Akzeptierte Antwort
MathWorks Support Team
am 10 Feb. 2011
This is a bug in MATLAB 6.5 (R13) in the way that SAVEAS handles PNG-files. Our development staff is investigating this issue.
Currently, to work around this issue, try the following:
figure;
set(gcf,'position',[0 100 1000 800]);
axes('fontsize',28);
title('Title');
xlabel('X Axis');
f=getframe(gcf);
[X, map] = frame2im(f);
imwrite(X,'tmp.bmp');
imwrite(X,'tmp.png');
You will notice that the "Position" property has been changed to move the figure window above the Windows taskbar which is typically at the bottom of the screen. This is currently necessary to avoid including the taskbar in your saved image. Our development staff has been notified and is currently investigating this issue as well.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Printing and Saving finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!