xlim and ylim not working for plot
显示 更早的评论
I wanted to plot a line and wanted to generate several figures. I wanted all of the plots to have the same axes but xlim and ylim are not being incorporated in the plots generated.
for i = 1:(timepoint+1)
figure(1)
hold on
plot(whole(j:j+i,1),whole(j:j+i,2), '--or')
ylim = [-2 5];
xlim = [0 20];
F(i) = getframe(gcf) ;
drawnow
end
Array indices must be positive integers or logical values.
采纳的回答
更多回答(1 个)
Image Analyst
2022-12-19
1 个投票
@DGM gave you the answer, but I just thought I'd add on some extra optional stuff, like if you want to take all your plots and make a movie out of them. See attached demo.
类别
在 帮助中心 和 File Exchange 中查找有关 Line Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!