Save Matlab Plot as PDF - Not Showing Yline text in R2024b

3 ビュー (過去 30 日間)
Cody Brown
Cody Brown 2025 年 2 月 26 日
回答済み: Cody Brown 2025 年 2 月 28 日
I have an application which I am making updates to, one of which includes migrating to Matlab's latest version R2024B. I encounted an issue which I have been able to simplify into a repeatable script.
The issue is only with the latest version of matlab not saving the Yline text when saving a fig as a pdf. This Yline text apears fine in older versions of Matlab (tested R2020a)
Run the following code in matlab R2024b and then in R2020a and see the difference:
f = figure;
plot([1,2,3,4],[1,2,3,4]);
yline(2.5,':r',"2.5");
xline(1.75,':r',"start");
set(f, 'PaperOrientation','landscape');
set(f, 'PaperUnits','normalized');
set(f,'PaperPosition',[0 0 1 1]);
saveas(f,'test.pdf');
winopen('test.pdf');
Similarly, I have also seen issues with Xlines not showing at all in pdf's saved in this way from R2024b, and also have this same issue when using other funtions to save the fig as a pdf, like 'exportgraphics()'
While if I save to a .png or .jpeg the text and Xlines are saved fine, I would much rather use the .pdf, for the vector graphhics, copiable text, ease of printing to 8.5x11", ability to append pages, and reduced file size of the .pdf.
Please let me know if there are any setting I may change to get this funcationality in the latest matlab version to be the same as R2020a, or if Mathworks is working to fix this.
  2 件のコメント
dpb
dpb 2025 年 2 月 26 日
Since this seems to be reproducible and a new symptom with later release, I'd suggest submitting an official bug report.
Cody Brown
Cody Brown 2025 年 2 月 26 日
Thanks for conferming this, and forwarding me to the official bug report. I have the following bug fix request:

サインインしてコメントする。

採用された回答

Cody Brown
Cody Brown 2025 年 2 月 28 日
This issue apears to have been resolved in the current prerelease of Matlab R2025a, and in previous versions seems to be linked to using the new desktop add-on. In R2025a this new desktop add-on is part of the base instalation of Matlab, which includes a fix this issue.
With March around the corner, we will be looking for R2025a to go live.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeEnvironment and Settings についてさらに検索

タグ

製品


リリース

R2024b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by