Clear Filters
Clear Filters

Font problems when exporting box plot with Greek letters

1 view (last 30 days)
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:

Answers (1)

Abhinaya Kennedy
Abhinaya Kennedy on 17 Jun 2024
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.

Categories

Find more on Labels and Annotations in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!