Axes changes while plotting during a for loop

5 ビュー (過去 30 日間)
Isaac Valdez
Isaac Valdez 2020 年 6 月 16 日
コメント済み: Ameer Hamza 2020 年 6 月 17 日
I am using a for loop to plot multiple sets of data onto the same graph. I am runnning into the issue of when I run the "for loop", the figure is only capturing part of the data and not the entirity. If someone could explain why this is I would be greatful. Below is the code I am using and the picture that appears.
for i=1:NumBuildPlates
wblplot(B{i});
hold on
end
This is what appears but what I really want is the picture below without having to manually set the axes after it appears.
The picture below is what I want the loop to produce.

採用された回答

Ameer Hamza
Ameer Hamza 2020 年 6 月 17 日
Try adding this line at the end of your code
axis tight
For example
for i=1:NumBuildPlates
wblplot(B{i});
hold on
end
axis tight
  6 件のコメント
Isaac Valdez
Isaac Valdez 2020 年 6 月 17 日
That worked perfectly for both the x and y axis.
If you mind me asking, how come xlim([-inf inf]) worked and not "axis tight"?
Nonetheless, thank you!
Ameer Hamza
Ameer Hamza 2020 年 6 月 17 日
I am glad to be of help!
axis tight changes both x and y-axis, whereas xlim([-inf inf]) only fits the x-axis.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAnnotations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by