Plotting leaving empty space before line begins
9 ビュー (過去 30 日間)
古いコメントを表示
So this plot has a gap before the beginning of the line. I have checked the arrays being inputted and they have the correct values and therefore there should be no gap.
My current theory is based on the bottom and that when the program plots the points it is rounding the axis numbers and therefore not centering the graph at the start of the line.
Any ideas on how to fix this?
0 件のコメント
採用された回答
Cris LaPierre
2021 年 5 月 13 日
編集済み: Cris LaPierre
2021 年 5 月 13 日
Yes, by default MATLAB will attempt to set the ticks at round numbers. If you prefer to have the limits exactly match your data, use axis tight
x = rand(1,5);
y = rand(1,5);
tiledlayout(1,2)
nexttile
plot(x,y)
title('Normal')
nexttile
plot(x,y)
title('axis tight')
axis tight
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!