change the step in x label

조회 수: 18 (최근 30일)
Alon
Alon 2013년 11월 27일
댓글: Alon 2013년 11월 27일
Hello, I have made histogram shown in the picture attached. As you can see, the X lable is ticked with the numbers: 95-125 with a space of 5 from each other. Is there any way(not manually) to make the spaces as 1 so that the plot will be shown automatically as : 95,96,97,...125 ? Thanks!

답변 (1개)

Wayne King
Wayne King 2013년 11월 27일
Use 'xtick' I'll do an example with Gaussian distributed data but I doubt you really want to space the ticks for every integer. I'll do one with a spacing of two.
x = 110+5*randn(100,1);
hist(x)
set(gca,'xtick',95:2:125)
Just use the set() command after you call hist()
  댓글 수: 1
Alon
Alon 2013년 11월 27일
hi, My program do the following thing: It reads lines from a file in a loop. in the loop I use: counts =counts+ histc(lower(line), 'a':'z');
before the prog ends I use: figure(1); bar(97:122,counts);
How do I use set function in my script? thank u

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

카테고리

Help CenterFile Exchange에서 Data Distribution Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by