Plot legend - cyrilic?
5 ビュー (過去 30 日間)
古いコメントを表示
I need to make cyrilic legend in Matlab plot. I am doing it with:
legend({'прва.'}, 'Fontname','Times new roman', 'FontSize', 16);
It is nice font, but when I export my plot in eps and use it in Latex, it is not nice font anymore.
If I do it with
legend({'прва.'}, 'Interpreter', 'LaTeX', 'FontSize', 16);
it will be the not nice font in both, Matlab and Latex.
Also, Italic command does not work with cyrilic in plot legend.
What should I do to make nice plot and nice font for cyrilic in Latex?
0 件のコメント
回答 (1 件)
sanidhyak
2025 年 4 月 7 日
I understand that you are trying to add a Cyrillic legend to your MATLAB plot using the provided code and although it displays well in MATLAB, the font does not appear correctly when exported to EPS and used in LaTeX. Also, using the LaTeX interpreter causes the font to degrade both in MATLAB and in the LaTeX document, and italicizing Cyrillic text does not work as expected.
These issues arise because the EPS format has limited support for Unicode characters and font embedding, which affects the rendering of non-Latin scripts such as Cyrillic. Moreover, the LaTeX interpreter in MATLAB does not support Unicode, so it does not handle Cyrillic characters properly.
To resolve this issue, I recommend switching from EPS to PDF export using “exportgraphics” function in MATLAB, which preserves Unicode characters and font styles more reliably.
Please refer to the corrected approach below:
figure;
% Example plot
plot(1:10);
% Cyrillic legend with proper font
legend({'прва.'}, 'FontName', 'Times New Roman', 'FontSize', 16, 'Interpreter', 'none');
% Export as PDF with vector content
exportgraphics(gcf, 'my_plot.pdf', 'ContentType', 'vector');
This approach would ensure that the Cyrillic text is preserved correctly with the desired font styling, and the output PDF can be directly included in LaTeX using “\includegraphics{my_plot.pdf}”.
Please refer to the below documentation on "exportgraphics" function for more details:
I hope this helps!
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!