Greek letters and label alignment in boxplot graph

2 visualizzazioni (ultimi 30 giorni)
Hello,
in three slightly different models I have calculated the results for the same 5 sets of parameter combinations and would like to display the results in a boxplot graph. This works so far well but the tick-labeling of the x-axis does not look nice for two reasons:
1) I cannot get the labels to show the real greek symbols
2) It would probably look nicer if the parameter set label (Base Case, etc.) would either be centered under the three respective graphs or at least left aligned with "M1"
Would be very thankful for any hints or advice!
Best regards
Christian
Here is the code as well as the graph it produces:
% Output of models: first column are results for 10.000 simulations of first parameter set,
% second column results of 10000 simulations of second parameter set, etc.
Model_1 = rand(10000,5);
Model_2 = rand(10000,5);
Model_3 = rand(10000,5);
DataforBoxplot = cat(2,Model_1, Model_2, Model_3); % Combine model data in one matrix
figure('units','normalized','outerposition',[0 0 1 1])
Parameterset = repmat({'Base Case' 'Case \alpha' 'Case \beta' 'Case r' 'Case \gamma'},1,3);
Modellabel = [ repmat({'M1'},1,5) , repmat({'M2'},1,5) , repmat({'M3'},1,5) ];
boxplot(DataforBoxplot, {Parameterset, Modellabel}, 'factorgap', [10 0], 'labelverbosity', 'minor')
title('Example graph')
ylabel('Model output')
xlabel('Model (1-3) and parameter set used')

Risposta accettata

Thorsten
Thorsten il 25 Nov 2015
To get Greek letters
Parameterset = repmat({'Base Case' ['Case ' char(945)] ['Case ' char(946)] 'Case r' ['Case ' char(947)]},1,3)
  6 Commenti
Christian
Christian il 25 Nov 2015
Modificato: Christian il 25 Nov 2015
Thanks a lot!
However with the Greek letters and the subscripts in the tick labels I get problems when exporting the figure. For the figure to fit into the overall journal text, I have to edit font and font size of all text within the figure. That works fine as long as I look at the figure only within Matlab. Exporting to pdf or eps format however causes the problem that every string that includes a Greek letter falls back into the original Matlab font type.
Here is the code I use and a snapshot as an example:
set(0,'defaultAxesFontName', 'Times New Roman')
set(0,'defaultTextFontName', 'Times New Roman')
set(0,'defaulttextfontsize', 12)
Model_1 = rand(10000,5);
Model_2 = rand(10000,5);
Model_3 = rand(10000,5);
figure('units','normalized','outerposition',[0 0 1 1])
DataforBoxplot = cat(2,Model_1, Model_2, Model_3);
Parameterset = repmat({'Base Case' ['Case ' char(945)] ['Case ' char(946)] 'Case r' ['Case ' char(947)]},1,3);
Modellabel = [ repmat({'M1'},1,5) , repmat({'M2'},1,5) , repmat({'M3'},1,5) ];
boxplot(DataforBoxplot, {Parameterset, Modellabel}, 'factorgap', [10 0], 'labelverbosity', 'minor')
hold on
title('Example graph')
ylabel('Model output')
xlabel('Model (1-3) and parameter set used')
iptsetpref('ImshowBorder','tight');
export_fig Testfile -pdf -transparent
Any ideas how to fix this file saving problem? Thanks so much!

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Labels and Annotations in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by