When displaying x-axis labels, show as scaled, how to

조회 수: 10 (최근 30일)
George
George 2012년 7월 13일
My plot returns x axis labels with values 0, 0.005, 0.01, 0.015, 0.02,...., 0.045 when it plots something. X-axis is time axis. My plot itself is fine, y-axis label is fine too.
In the x-axis, I want the label numbers to display in a scaled version: scaled by 10exp(-9). I want it to display like this: 0, 5, 10, 15... , 45 (x exp -9) Now, I am labeling my x-axis as "Time(myu.s)", but I want to be able to label as "Time (ns)".
Gurus, please help.
Thanks.

채택된 답변

Walter Roberson
Walter Roberson 2012년 7월 13일
curticks = get(gca, 'XTick');
set(gca, 'XTickLabel', cellstr( num2str( round(1e9 * curticks(:)) ) ) )

추가 답변 (1개)

George
George 2012년 7월 14일
Thank you, Walter. I used 1e3 instead of 1e9 and now my x-axis marks are showing as 0, 5, 10, 15... For the text labels I display Time (ns), and that makes sense. Task accomplished!
Thanks a lot, again.

카테고리

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