How to plot the temperature unit which is small circle raised at the left of C upper case?
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
Fangjun Jiang
2024-12-11
plot(1:10);
title({'Exit Cold Carrier Temperature [ \circC]', ' Cooling Capacity [W]'})
采纳的回答
更多回答(1 个)
Voss
2024-12-11
编辑:Voss
2024-12-11
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]'})
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Labels and Annotations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!