필터 지우기
필터 지우기

Formatting the plot command

조회 수: 1 (최근 30일)
u-will-neva-no
u-will-neva-no 2012년 12월 29일
Hi everyone, I currently have values on the x and y axis which are all to the power of 1 x 10^10. I would like this value to be next to each number next to the ticks. For example, on my x axis I have the numbers 1,2,3 at the ticks and at the end it has x10^10. Is there a way to format the axis so that it looks something like 1 x 10^10 2x10^10 3x10^10 ?
Thank you

답변 (3개)

per isakson
per isakson 2012년 12월 29일
There is no simple way to do that. However, it can be done with the help of the property, YTickLabel, of the handle graphic object, axes. The doc says:
XTickLabel, YTickLabel, ZTickLabel
string
Tick labels. A matrix of strings to use as labels for tick marks along the
respective axis. These labels replace the numeric labels generated by MATLAB.
If you do not specify enough text labels for all the tick marks, MATLAB uses
all of the labels specified, then reuses the specified labels.

José-Luis
José-Luis 2012년 12월 30일
xVals = 1e10:1e10:1e11;
aH = axes;
plot(aH,xVals,rand(10,1));
set(gca,'XTickLabel',sprintf('%2.0e|',xVals));
Please see
doc sprintf
for other possible label formats.

Jan
Jan 2012년 12월 30일

카테고리

Help CenterFile Exchange에서 Axis Labels에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by