フィルターのクリア

Log-log plot which doen't display every values

5 ビュー (過去 30 日間)
Flo
Flo 2016 年 7 月 1 日
コメント済み: the cyclist 2016 年 7 月 4 日
Hi everyone,
I believe some data I am playing with could be better displayed using a loglog plot. my vector:
y =
45 67
4 8
3 3
0 0
0 3
0 0
0 0
0 0
0 0
1 0
So, if I correctly plot that I should end-up with five marks on my graph right ? which is confirmed by the bar graph I get through my code:
So far my code only display three points... and I obviously need to display them all. Would you help me on that? Is it because the loglog function can't allow you don't display values equal to zero ?
my code:
none = length(one)
ntwo = length(two)
h(1:none,1)=one
h(1:ntwo,2)=two
[y,x]=hist(h)
stringTitle1 = 'test'
stringTitle2= ' comparison'
bar(x,y, 'group')
title('test title')
xlabel('test name') % x-axis label
ylabel('Frequency') % y-axis label
legend('XZ','YZ')
xLog = y(:,1)
yLog = y(:,2)
loglog(xLog,yLog,'.')
Cheers, Flo

回答 (1 件)

the cyclist
the cyclist 2016 年 7 月 1 日
編集済み: the cyclist 2016 年 7 月 1 日
The basic problem is that log(0) is "equal" to negative infinity, so cannot be displayed.
  2 件のコメント
Flo
Flo 2016 年 7 月 4 日
編集済み: Flo 2016 年 7 月 4 日
Alright, I see. it makes more sense. Would you suggest a way of better displaying a result like that :
Thank you for your help.
Flo
the cyclist
the cyclist 2016 年 7 月 4 日
A simple option is to use a log(x+1) rather than a log(x) transformation to display the data. In other words, just add 1 to your data before using loglog. There are pros and cons to this approach. Here is one place you could read a bit about the practical aspects.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeGraphics Object Identification についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by