both text and numbers in axis

I'm wondering if matlab is able to customize the axis where some of the ticks are strings and some of the ticks are number?
or inconsistent tick marks (for example, tick marks 1-5 in 1 tick intervals, then 5-100 in intervals of 5?

 채택된 답변

Walter Roberson
Walter Roberson 2012년 6월 20일

0 개 추천

set(gca, 'XTick', [1 2 3 4 5 10 15])
set(gca,'XTickLabel',{1 2 3 4 'Hello' 10 15})

댓글 수: 3

David C
David C 2012년 6월 20일
works like a charm Walter
now I ran into the issue of the primary and secondary axis not aligned
my primary goes from -5 to 20 in increments of 5 and my 2ndary goes from -5 to 100 in increments of 10
both axes from -5 to 0 goes from increments of 1.
the 0 on the 2ndary axis is much lower than the 0 on the primary axis :(
Walter Roberson
Walter Roberson 2012년 6월 20일
I'm not sure what you are referring to about primary and secondary axis? Are you using plotyy() ?
David C
David C 2012년 6월 21일
yessir! but i figured it out
I had to manually scale the axes to make the ticks match the values
I'm grateful as always :)

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

추가 답변 (0개)

카테고리

태그

Community Treasure Hunt

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

Start Hunting!

Translated by