determine axis limits *before* plotting..?
Mostrar comentarios más antiguos
Hi everyone,
I need to determine the y-axis limits "before" rendering my plot, b/c the elements are rendered in a loop, one at a time. xlim() isn't any use in this case. Will I have to reverse-engineer MATLAB's algorithm, or is there another approach?
Thanks, Brad
3 comentarios
Oleg Komarov
el 9 de Sept. de 2012
I don't understand your question. Can't you use xlim after the loop?
Bradley Stiritz
el 9 de Sept. de 2012
Oleg Komarov
el 9 de Sept. de 2012
I think we might help you if you posted the code.
Respuesta aceptada
Más respuestas (1)
Image Analyst
el 9 de Sept. de 2012
You can save the y and x limits for the current axes at any time by using the ylim and xlim functions:
% Save initial limits.
initial_ylim_values = ylim();
initial_xlim_values = xlim();
% Now plot something that will change the ylimits
plot(x, y); % Some y that will change the y limits.
after_ylim_values = ylim();
after_xlim_values = xlim();
2 comentarios
Bradley Stiritz
el 9 de Sept. de 2012
Image Analyst
el 9 de Sept. de 2012
Then you need to set "hold on" and MATLAB will "lock down" all those settings and not allow subsequent plots to change them.
Categorías
Más información sobre Graphics Performance en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!