Display Log scale on y axis of graph
이전 댓글 표시
Hi, if anybody could help me with this i would be really greatful, im trying to plot the blackbody radiation for a number of temperatures from 3 kelvin - 1million kelvin
However it is very hard to see the smaller plots due to the weights of the high temperatures, therefore i need the y axis to increase logarithmically WITHOUT getting the log of the data. so how can i change the axis????
thanks in advance, if you can answer this within a day you are my new hero!!
답변 (2개)
Rick Rosson
2011년 10월 2일
>> doc semilogy
댓글 수: 3
James
2011년 10월 2일
Rick Rosson
2011년 10월 2일
1. Please read the documentation
2. Please try it. It works.
James
2011년 10월 2일
Harry MacDowel
2011년 10월 2일
A log scale but not the log of your data, that is exactly what semilogy is doing.
In fact I think you are not stating your problem very clearly either. What do you really want?
If you have a log axis, but then your data is not logarithmic, do you mean that you don't want to transform the data through a calculation process of your own/the Matlab or, you want to plot the 'original' data under a log scale? That would be quite absurd since your data would be jam-packed into a bundle of dots 'collapsing' onto each other.
If you really want to do this, you can achieve it by transforming the axis. Do something like,
ylimit = [0,35];
ytic = [0 5 10 15 20 25 30 35];
ylimit2 = log(ylimit);
ytic2 = log(ytic);
ytic2str = str2num(ytic2');
ax1 = gca;
ax2 = axes('Position',get(ax1,'Position'),'Color','none');
set(ax2,'ylim',ylimit,'ytick',get(ax1,'ytick'),'xtick',get(ax1,'xtick'),'xticklabel',[],'yticklabel',ytic2str);
댓글 수: 5
James
2011년 10월 2일
Walter Roberson
2011년 10월 2일
num2str() rather than str2num()
Harry MacDowel
2011년 10월 3일
sorry was writing that piece too fast I didn't notice it.
Yeah Walter got it there. It's num2str not str2num. Sorry.
James
2011년 10월 7일
Harry MacDowel
2011년 10월 8일
yes that code is replacing the labels on the y-axis without altering anything in regard to the original plot or the data itself. That's why I am asking you in the first place, what do you want?
Please do realize that currently the ytic in the codes I given hasn't been altered by you either.
If you want to view the data on a log scale way above the limit of your current y data, please change the limit yourself and thus the ensuing codes.
카테고리
도움말 센터 및 File Exchange에서 Scopes and Data Logging에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!