Can set the lower limit of the axis manually but leaving to auto the upper limit

63 visualizaciones (últimos 30 días)
I want to control only the lower limit of the axis and not the upper. I want the upper to be automatic. Is there any way to do it with set?

Respuestas (3)

Azzi Abdelmalek
Azzi Abdelmalek el 1 de Jun. de 2013
xlim([2 inf])
ylim([4 inf])
  1 comentario
Ben Ralph
Ben Ralph el 27 de Nov. de 2018
Editada: Ben Ralph el 27 de Nov. de 2018
This one worked well for me.
Well, I actually used:
ax = gca;
ax.YLim = [0 inf];
Thanks!

Iniciar sesión para comentar.


Giorgos Papakonstantinou
Giorgos Papakonstantinou el 1 de Jun. de 2013
I did finally this. If I want for example my lower limit to be 2:
limsy=get(gca,'YLim');
set(gca,'Ylim',[2 limsy(2)];
  7 comentarios
Pw
Pw el 4 de Sept. de 2014
The solution worked great for me:
limsy=get(gca,'YLim');
set(gca,'Ylim',[2 limsy(2)];
Quick question, what does the 2 in limsy(2) indicate. I feel as if I should know the answer but it is eluding me at the moment.
Thanks!
Jason
Jason el 18 de Nov. de 2014
2nd value from Ylim (i.e it consists of ymin and ymax), so it reports back ymax

Iniciar sesión para comentar.


Walter Roberson
Walter Roberson el 1 de Jun. de 2013
No.
You could probably work something up using a listener or two to detect changes to the xdata or ydata and to set() the xlim and ylim as appropriate. I wouldn't bother doing it that way, though.

Categorías

Más información sobre Annotations en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by