Scalling Y-Axis

1 回表示 (過去 30 日間)
Aldo Milleano
Aldo Milleano 2022 年 8 月 24 日
回答済み: vamshi sai yele 2022 年 8 月 27 日
I have 3 matrices with similar values (m1_iter, m2_iter, m13_iter) the difference is on 2,3,4,5 digits behind the comma. I want to change the y axis so I can see the gap between 3 graph.

回答 (2 件)

Cris LaPierre
Cris LaPierre 2022 年 8 月 24 日
I would plot the difference between m1_iter & m2_iter, m1_iter & m13_iter, and m2_iter & m13_iter.
  3 件のコメント
Cris LaPierre
Cris LaPierre 2022 年 8 月 24 日
That is why I am suggesting you just plot the difference.
If your line were flatter, you might be able to play with the scale of the yaxis to increase the visual separation between the lines, but given the slope of your line, you cannot both adjust the scale and still see all the data without actually modifying the y values.
Aldo Milleano
Aldo Milleano 2022 年 8 月 24 日
Okey, i see now. Thank you so much

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


vamshi sai yele
vamshi sai yele 2022 年 8 月 27 日
Hi Aldo,
As per my understanding you want to figure out the gap between two lines.
Zooming into the graph, which means reducing the axis boundaries and increasing the number of intervals, will allow us to see between two graph lines more clearly.
We can make advantage of the "axis" property to define the axis bounds. The code for this case is shown in more detail below:
x = linspace(0,10);
y = x.^2;
k = y+1
plot(x,y)
hold on
plot(x,k)
hold off
If we execute the above code, we can see two lines plotting on the graph with limits from 1-10 on x-axis and with 0-100 on y-axis, but the gap between two lines is very narrow.
To zoom the y-axis and to amplify the gap between two lines, set the axis property as shown below.
x = linspace(0,10);
y = x.^2;
k = y+1;
plot(x,y);
hold on
plot(x,k)
hold off
Axis([0 10 0 10])
Here, I would like to mention that it is preferable to scale the x-axis as well in order to have a clear impression of the gap between two lines. The optimum outcome is obtained by scaling both axes appropriately.
Try the code below, where we have adjusted the x-axis as well for obvious effects.
x = linspace(0,10);
y = x.^2;
k = y+1
plot(x,y)
hold on
plot(x,k)
hold off
Axis([0 2 0 10])
Hope the answer was helpful!!
For your reference and to learn more about this, kindly refer to this link.

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by