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!