필터 지우기
필터 지우기

Can a plot be made to label y-axis in Hex values?

조회 수: 22 (최근 30일)
Art
Art 2012년 3월 7일
댓글: Walter Roberson 2015년 10월 30일
I am plotting decimal equivalents of 8 and/or 16 bit hex values. Is it possible to label the y-axis in it's hex value? (Other than using yticklabel and manually listing all possible values)

채택된 답변

Walter Roberson
Walter Roberson 2012년 3월 7일
set(gca, 'YTickLabel', cellstr(num2str(reshape(get(gca, 'YTick'),[],1),'%02x')) )
This still uses YTickLabel, but it does not manually list all the possible values.
  댓글 수: 2
Alan
Alan 2015년 10월 29일
This helps. Unfortunately, if I resize any of my graphs after running this, the tick marks get all messed up. That's a reason to not use YTickLabel even though it's not a manual list. Is there another method that would rescale values as appropriate? Or a way to detect a rescale and reapply yticklabel?
Walter Roberson
Walter Roberson 2015년 10월 30일
Note: an axes is not a "container" and does not have a ResizeFcn callback. If you are setting the Position or OuterPosition properties of an axes to resize it, then you should rebuild the labels at that point. You might also be able to set a listener to detect the event.
Note: if you are using zoom or pan, then both of those offer a Post action callback that can be used to rebuild the tick labels.

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

추가 답변 (0개)

카테고리

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