How to plot the temperature unit which is small circle raised at the left of C upper case?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Basim Touqan
am 11 Dez. 2024
Kommentiert: Voss
am 16 Dez. 2024
I have a plot where it must have a titel as in the following MATLAB command:
title({'Exit Cold Carrier Temperature [ \circC]', ' Cooling Capacity [W]'})
when I run the plot command, the result I get is obtained with no small circle (the resulted plot is attached) .
Kindly advise what is the correct way to have the Celsius unit as small circle raised to the left of C upper case?
1 Kommentar
Fangjun Jiang
am 11 Dez. 2024
plot(1:10);
title({'Exit Cold Carrier Temperature [ \circC]', ' Cooling Capacity [W]'})
Akzeptierte Antwort
Weitere Antworten (1)
Voss
am 11 Dez. 2024
Bearbeitet: Voss
am 11 Dez. 2024
In order to have '\circ' be rendered as the degree symbol in a text object's String, the text object's Interpreter must be 'latex'. 'latex' is the default text interpreter, so unless you changed the default or specified a different interpreter for this particular title, the degree symbol will be rendered. Given that the code shown doesn't set the interpreter, I'll assume somewhere else you changed the defaultTextInterpreter root property to 'none'.
An alternative to using '\circ' is to put the degree symbol directly in your text's String, either using char(176) or °, in which case the text object's interpreter can be 'tex' or 'none' for this particular String.
% set the default root defaultTextInterpreter property to 'none', to
% attempt to reproduce the problem:
set(0,'defaultTextInterpreter','none')
% create a figure with 4 tiles:
figure('Position',[10 10 800 500])
tiledlayout(2,2)
% problem: default 'none' interpreter:
nexttile()
title({'Exit Cold Carrier Temperature [ \circC]', ' Cooling Capacity [W]'})
% solution 1: explicitly using 'tex' interpreter for this text object:
nexttile()
title({'Exit Cold Carrier Temperature [ \circC]', ' Cooling Capacity [W]'},'Interpreter','tex')
% solution 2a: using char(176):
nexttile()
title({['Exit Cold Carrier Temperature [ ' char(176) 'C]'], ' Cooling Capacity [W]'})
% solution 2b: using °:
nexttile()
title({'Exit Cold Carrier Temperature [ °C]', ' Cooling Capacity [W]'})
2 Kommentare
Siehe auch
Kategorien
Mehr zu Labels and Annotations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


