How to change the numbering system in the y axis? pitcure inside
조회 수: 2 (최근 30일)
이전 댓글 표시
Hi
I am new user to Matlab. I have 2 million entries and want to plot them as histogram. The problem I am getting the figure as the one attached where you can notice the y axis start from 0*10^5,0.5*10^5, ..... where I want it like: 1*10^5,2*10^5.... I want the y axis appear like the second picture.
<</matlabcentral/answers/uploaded_files/14594/Untitled.jpg
>>
here is the code I am using:
mydata1=load('data_m256_k5_n37.txt');
pp=hist(mydata1(:,1),max(mydata1(:,1))-min(mydata1(:,1))+1);
figure(1)
bar(min(mydata1(:,1)):max(mydata1(:,1)),pp,'w', 'LineWidth',2)
grid on
xlabel('\rho','FontSize',12)
ylabel('','FontSize',12)
댓글 수: 0
답변 (4개)
Sara
2014년 6월 24일
I can't see Fig 2 but I think you can rescale the yaxis and the replace the y-ticks if you want the exponent close to each tick:
xx = pp/1e5;
bar(min(mydata1(:,1)) : max(mydata1(:,1)),xx,'w', 'LineWidth',2)
yt = get(gca,'ytick')
ytstr = cell(numel(yt),1);
for i = 1:numel(yt)
ytstr{i} = [num2str(yt(i)),char(215),'10^5'];
end
set(gca,'YTicklabel',ytstr)
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Line Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!