Legend position change after printing
10 ビュー (過去 30 日間)
古いコメントを表示
I draw a bar figure and set the legend using
leg = legend('w/s QOS','w/o QOS','Location','best');
And then I try to save the figure using print
fig2.PaperPositionMode = 'manual';
fig2.PaperUnits = 'points';
fig2.PaperPosition = ([0 0 1920 1080]);
print('./figure/delay_avg','-djpeg');
The following figure is what I have in Matlab window
and the figure below is the figure saved in the file
As you can see, the position of the legend changes. Is this a bug of Matlab? I'm using R2015a
0 件のコメント
回答 (6 件)
Brian Pierre
2016 年 6 月 14 日
I have the same issue in 2014b. A big problem for a large automated report with thousands of figures.
0 件のコメント
Abhinav Gupta
2022 年 5 月 21 日
編集済み: Abhinav Gupta
2022 年 5 月 21 日
This problem still exists in the R2021b. It would be great if this could be fixed!
0 件のコメント
Eric Delaunay
2023 年 1 月 19 日
Found a workaround :
l = findobj(gcf, 'type', 'legend');
set(l, 'Location', 'none');
before printing. It disables auto layout for legend and uses its current 'position' for printing. It works for me in R2017b.
1 件のコメント
Rohit Kudva
2015 年 10 月 22 日
Hi Junyi,
I work for MathWorks and I have forwarded this feedback to the appropriate product team.
Regards,
Rohit
1 件のコメント
Thorsten
2016 年 6 月 15 日
Use
set(gcf,'PaperPositionMode','auto');
before printing. It works for me (R1015b).
0 件のコメント
Mark Kerssenfischer
2022 年 12 月 2 日
Indeed, I just ran into the same issue in Matlab R2021b.
Please fix it!
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Legend についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!