Remove exponent from plot axis label
조회 수: 55 (최근 30일)
이전 댓글 표시
Hi, all.
I'm trying to remove the scientific format from my Y-axis label for my plot in MATLAB R2020a shown below.
I've tried everything I can find but, for the life of me, I cannot seem to get the Y-axis labels to display 10, 100, etc. instead of 10^1, 10^2, etc.

My plot code is as follows:
figure; semilogy(Pos, TC1, Pos, TC2, Pos, TC4, Pos, TC16)
legend('1C', '2C', '4C', '16C')
xlabel('Air Sample Position')
ylabel('Temperature (^{o}C)')
title('Temperature vs Position')
grid on
ax = gca;
ax.YAxis.TickLabelFormat = '%.0f';
ax.YAxis.Scale = 'log';
ax.YAxis.ExponentMode = 'manual';
ax.YAxis.Exponent = 0;
ax.YAxis.MinorTick = 'on';
Can anyone assist, please?
댓글 수: 2
Paul
2023년 6월 22일
But the doc doesn't say anything about ignoring TickLabelFormat for a log scale, I don't believe, which is the property that I think the Question is really about. For a semilogy plot, the Y-TickLabelFormat is %g, even though that's not the format actually used for display
semilogy(1:100,1:100),grid,ax = gca;
ax.XAxis.TickLabelFormat
ax.YAxis.TickLabelFormat % YTickLabels display should be similar/same to XTickLabels?
I poked around trying to find something that overrides the %g format for the YAxis, but couldn't find it. Maybe just a gap in the doc?
답변 (1개)
Angelo Yeo
2023년 6월 22일
yticklabels(string(yticks))
댓글 수: 3
Angelo Yeo
2023년 6월 22일
편집: Angelo Yeo
2023년 6월 22일
I don't understand why you run into such an issue. Please see the code below.
Pos = 1:7;
TC1 = [20, 200, 350, 500, 350, 200, 20];
figure; semilogy(Pos, TC1)
legend('1C')
xlabel('Air Sample Position')
ylabel('Temperature (^{o}C)')
title('Temperature vs Position')
grid on
yticklabels(yticks)
참고 항목
카테고리
Help Center 및 File Exchange에서 Axis Labels에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


