Font problems when exporting box plot with Greek letters

1 回表示 (過去 30 日間)
Christian
Christian 2015 年 11 月 30 日
回答済み: Abhinaya Kennedy 2024 年 6 月 17 日
Hello everyone,
I am trying to graph a box plot with tick-labels that include greek letters and with the entire text being in font 'Times New Roman'. When I execute the following example code, Matlab produces exactly what I want, however in the exported pdf document, the labels including Greek letters are not produced in Times New Roman. Below I also attach a snapshot of the PDF end-product.
Any suggestions on how I can get the same Times New Roman font and size for all labels, including the ones in Greek letters?
Thanks so much for any advice!
set(0,'defaultAxesFontName', 'Times New Roman')
set(0,'defaultTextFontName', 'Times New Roman')
set(0,'defaulttextfontsize', 12)
DataforBoxplot = rand(10000,5);
figure('units','normalized','outerposition',[0 0 1 1])
Label = {'Base Case' ['Case ' char(945)] ['Case ' char(946)] 'Case r' ['Case ' char(947)]};
boxplot(DataforBoxplot, Label)
title('Example graph')
ylabel('Model output')
xlabel('Model (1-3) and parameter set used')
iptsetpref('ImshowBorder','tight');
export_fig Testfile -pdf -transparent
Here is a close-up of the problem:

回答 (1 件)

Abhinaya Kennedy
Abhinaya Kennedy 2024 年 6 月 17 日
You can use the "export_fig" function. (https://www.mathworks.com/matlabcentral/fileexchange/23629). This saves Figure/axes and is reproduced as it appears on screen.

カテゴリ

Help Center および File ExchangeLabels and Annotations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by