Current figure window resizes when calling "print" [recent change in functionality]?
古いコメントを表示
I'm using 2018b on MS Windows 10 and have recently noticed that calling either of
print(gcf)
print(gcf,'-dpng','filename.png')
first resizes the gcf window before printing. I believe this has something to do with MS Windows and printers (even software printers?), as I think the behavior changed after a MS Windows auto update (and I am fairly confident that this was not the default behavior at other times while using 2018b).
Is this a known issue? Can I make it stop? I use print regularly for figure export to image files, and resizing the gcf window changes aspect ratio, font size, etc.
6 件のコメント
Dan Gianotti
2019 年 1 月 10 日
Jan
2019 年 1 月 11 日
H = figure('Position', [100, 100, 200, 160]);
drawnow;
H.Position
print(H)
H.Position
Does this mean, that you get different outputs for this code? And the output does have an unexpected size? Which size? Does your figure has a ResizeFcn?
Dan Gianotti
2019 年 1 月 11 日
Dan Gianotti
2019 年 1 月 11 日
編集済み: Dan Gianotti
2019 年 1 月 11 日
Walter Roberson
2019 年 1 月 11 日
MATLAB resizes the figure and changes its background during print in order to satisfy PaperPosition and Hardcopy inverse requirements , and then changes back. This is often visible. There are race conditions if you try to interact with the figure during that time.
Hi Dan,
I am finding the same issue. It's extremely annoying! (Windows 7 Professional)
Thank you for investigating and isolating the cause.
I've noticed that if I manually re-size the figure instead of (or after) using the maximise button, then the problem also does not occur.
回答 (1 件)
Christopher Beckett
2019 年 12 月 19 日
Hi all,
I found this same issue as well and related it back to the print command. Instead of using print, I used the saveas function:
set(gcf,'PaperUnits','inches');
set(gcf,'PaperSize', [16 8]);
set(gcf,'PaperPosition',[-1 0 18 8]);
set(gcf,'PaperPositionMode','Manual');
saveas(gcf,'MyFig.pdf')
which has worked so far, with the same result as when using "print" with Windows 8, i.e. the saved figure is no longer affected by window resizing.
カテゴリ
ヘルプ センター および File Exchange で Creating, Deleting, and Querying Graphics Objects についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!