How to plot the temperature unit which is small circle raised at the left of C upper case?
조회 수: 3 (최근 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에서 Special Values에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!