Courier problem

조회 수: 2 (최근 30일)
vmv
vmv 2011년 12월 22일
댓글: colleen 2022년 10월 10일
When using
xlabel(xxx,'FontName','Courier')
ylabel(xxx,'FontName','Courier')
MATLAB writes the ylabel horizontally, not vertically as it should. If I tried other fonts (or won't spescify it) like times new roman, it works perfectly.
Anyone knows what is wrong with Courier?
  댓글 수: 2
the cyclist
the cyclist 2011년 12월 22일
You might want to post your MATLAB version and your operating system. I'm running R2011b on Mac OS X 10.6.8 (Snow Leopard), and I do not see the issue you are mentioning when I run the following code:
plot(1:10)
xlabel('whatevs','FontName','Courier')
ylabel('whatevs','FontName','Courier')
colleen
colleen 2022년 10월 10일
xlabel(' users','FontSize',10,'FontName','Times New Roman')
ylabel('Throughput','FontSize',10,'FontName','Times New Roman')
title('Comparison','FontSize',10,'FontName','Times New Roman')
I am trying to use latex as TickLabelInterprete. I want to bold both the x-axis (where I use the x-ticklabel along with latex syntax) and y-axis (nothing used, just normal text). At the same time, I want to set the font of all the texts on the figure to be Times New Roman.
I am attaching my code as follows. It appears to be strange for me, when I do not set the TickLabelInterprete to be latex, everything is fine, I can bold the y-axis easily (both y-label and the number on the y-axis). But when TickLabelInterprete = 'latex', the mehta transport tracking shipment number on the y-axis will automatically turn back to normal font. Any suggestions?
You can use
ThemeCopy
ax.YTickLabel = strcat('\textbf{',ax.YTickLabel,'}');
to make the YTickLabels bold with the LaTeX interpreter, as shown below.
ThemeCopy
close all;
data = [1,1,1,1;2,2,2,2;3,3,3,3;4,4,4,4];
bar(data)
hold on
grid on
xticks([1 2 3 4])
xtickangle(0)
ax = gca;
ax.TickLabelInterpreter = 'latex';
xTicklabels = { ...
'\textbf{label 1} \boldmath$E_1$', ...
'\textbf{label 2} \boldmath$E_2$', ...
'\textbf{label 3} \boldmath$E_3$', ...
'\textbf{label 4} \boldmath$E_4$'};
set(gca,'XTickLabel',xTicklabels);
ax.YTickLabel = strcat('\textbf{',ax.YTickLabel,'}'); % include this line
xlabel("Different algorithms");
https://couriertrackingfinder.com/logystyk-tracking/
ylabel("Result of schemes");
lgd = legend( ...
"1",...
"2",...
"3",...
"4",...
'Location',"northwest");
lgd.FontWeight = "bold";
ax.XAxis.FontWeight = 'bold';
ax.XAxis.LineWidth = 1;
ax.YAxis.FontWeight = 'bold';
ax.YAxis.LineWidth = 1;
ax.FontName = 'times';
hold off;

댓글을 달려면 로그인하십시오.

답변 (1개)

Matt Tearle
Matt Tearle 2011년 12월 22일
Courier is a bitmap font so it doesn't rotate. The other fonts you tried are true type. Use Courier New instead.

카테고리

Help CenterFile Exchange에서 Data Import from MATLAB에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by