How can I specify axis spacing?

조회 수: 45 (최근 30일)
Susan
Susan 2019년 6월 12일
댓글: Star Strider 2019년 6월 12일
Hey Guys,
I am plotting a figure that x takes values of [4 8 16 32 64 128 256 512 1024]. I use
%%
x = [4 8 16 32 64 128 256 512 1024];
plot(x, Y)
set(gca,'XTick',x)
The problem is the x-axis = [4 8 16 32 ] overlap and it's not readable. How can I fixed that? Many thanks in advance!untitled.jpg
  댓글 수: 2
Jan
Jan 2019년 6월 12일
Use a logarithmic scale. Then the ticks are equi-distant.
Susan
Susan 2019년 6월 12일
Thank you so much! Could you please take a look at the following comment and let me know if you have any sugesstions? Thanks in advance!

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

채택된 답변

Star Strider
Star Strider 2019년 6월 12일
One option:
x = [4 8 16 32 64 128 256 512 1024];
plot(log2(x), Y)
set(gca,'XTick',log2(x), 'XTickLabel',x)
It would be a bit easier if we knew ‘Y’, and what you wnat it to look like.
  댓글 수: 4
Susan
Susan 2019년 6월 12일
Thank you SO much!
Star Strider
Star Strider 2019년 6월 12일
As always, my pleasure!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by