Hi,
I have a problem regarding bining x axis in a plot.
I have an array that I want to plot it. In biochemistry is cardinality of reactions.
Then my boss asked me:
"x axis should be binned and put into log10 scale to show linear relationship. I think you need to create bins on the x scale, equally spaced in log scale, then the value of each bin is the number of reactions with cardinality between an interval on log scale. This code may help...
But I do not know how to plot is in the way that we see linearity with bining x logarithmly?
I would be appricaite if someone could guide me?
Best regards,
Susan

댓글 수: 4

darova
darova 2019년 10월 28일
There is sparse matrix with some values in the attached file. What do they represent?
Susan Ghaderi
Susan Ghaderi 2019년 10월 28일
this is a sparse array, which represent the cardinality of some reactions. First I should ordered them and then plot them. Then
I use this peice of code:
load('card.mat')
s=-sort(-d)
plot(log10(s),'*')
then I got the above figure.
But what I need to do, is to bin x logarithmically and then again plot it to get a linear plot.
In I want to make it simple if we have an m by n matrix, S, which m is the number of rows, and n is the number of columns this vector, d= sum(S~=0). Now, d represent how many nonzero elements are in each column.
darova
darova 2019년 10월 28일
You mean this?
x = log10(1:n);
plot(x,s)
Susan Ghaderi
Susan Ghaderi 2019년 10월 28일
No, I do not think so. Becasue it does not show something linear.I guess he means something like figure 5 in this link https://arxiv.org/pdf/1011.1533.pdf
But I do not know how to get that.

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

답변 (1개)

Siriniharika Katukam
Siriniharika Katukam 2019년 10월 31일

1 개 추천

Hi
Try replacing
plot(x,y)
to
semilogx(x,y)
‘semilogx’ turns the x-axis to a Logarithmic scale as in the figure that you provided in the above commented link. Further details can be got from this link:
and for logarithmic scale on y-axis, use ‘semilogy’.

카테고리

도움말 센터File Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기

태그

질문:

2019년 10월 28일

답변:

2019년 10월 31일

Community Treasure Hunt

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

Start Hunting!

Translated by