how to plot with different distance on vertical axis
9 views (last 30 days)
Show older comments
Hi guys , i have a vector x and a vector y. i want to plot(x,y) but i want : in vertical axis ,the distance from value: 0 to value: 10 is as long as the distance from value: 11 to value: 100 . I don't know how i can do that . Can you help me ? .Thank you very much !

0 Comments
Accepted Answer
John BG
on 28 Sep 2016
instead of plot(x,y) use function semilogx(x,y)
try it if it really does what you want, would you please be so kind to mark my answer as accepted thanks in advance
John BG
2 Comments
John BG
on 28 Sep 2016
ok, the original question was that you wanted axis x same distance between 0 to 10, than 11 to 100.
If you want the vertical axis then use
semilogy(x,y)
but please note that the picture you have attached to your question is already semilogy(x,y)
If you want y axis to start on 0 and go up to 10 then try the following
semilogy(x,1/10*log10(y))
Regards
John BG
More Answers (1)
Walter Roberson
on 29 Sep 2016
In your diagram, you appear to be using linear from 1 up to 10, and then log. There is no built-in facility for that.
What you might be able to do is grab a routine from the File Exchange such as Break Y Axis and once you have used that to split your range, set the upper axes to be log.
I have not investigated to see whether the code there automatically handles Datatips, or whether you need to break up your lines yourself into two parts.
In your text request you are asking for support starting from 0 . This is why I say you are asking for linear: in any log plot, the distance from 1/100 to 1/10 would be the same as the distance from 1/10 to 1 which would be the same as the distance from 1 to 10, and so on. You cannot display all the way down to 0 on a log plot, because log(0) is -infinity.
1 Comment
John BG
on 30 Sep 2016
Dear Walter
my impression is that the question revolves around the values of the axis not the function values.
So to go from [1:step1:1e3] to let's say [0:step2:3] all you need is the logarithm.
Also the question was rewarded from asking about the axis x to asking about the axis y. Some questions are more challenge to get to understand the problem asked rather than the problem itself or what we may guess that the problem is.
See Also
Categories
Find more on Annotations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!