limit the axes for plotting in Matlab [duplicate]

三世轮回 提交于 2019-11-28 14:51:40

Yes you can specify the limits directly on the axes using set or by calling the xlim, ylim, and zlim functions

plot(rand(1,100));
set(gca,'XLim', [10 20] ); % set the xlims to 10,20

or

plot(rand(1,100));
xlim([10 20]); % set the xlims to 10,20

Well, this is probably too obvious to be the solution to your problem, but in this line:

scatter(x(1:end-1), y(1:end-1),5, lg);

If lg is the same size as x and y, then clearly this is wrong and you need to do:

scatter(x(1:end-1), y(1:end-1),5, lg(1:end-1));

If this does not solve your problem, then as I stated in my comment you must provide complete code that we can run to reproduce the problem, including sample data for the x, y, and lg vectors.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!