Borrar filtros
Borrar filtros

Is it possible to just set the lower limit of the y-axis?

8 visualizaciones (últimos 30 días)
I just want to set the lower limit of the y-axis to zero.
But with 'ylim', I have to also set the upper limit, which I do not know what value is appropriate.
What should I do?
  2 comentarios
Mathieu NOE
Mathieu NOE el 19 de Abr. de 2024
you could set the upper limit to the max of the displayed data (so compute the max and use it in the ylim arguments)
Star Strider
Star Strider el 19 de Abr. de 2024
This should work —
ylim([0 max(ylim)])
.

Iniciar sesión para comentar.

Respuesta aceptada

Julius Muschaweck
Julius Muschaweck el 19 de Abr. de 2024
Two related ways I'm aware of (besides computing the max, which may be tedious with multiple plotted lines).
xx = linspace(0,2*pi,100);
yy = sin(xx);
figure(14);
clf;
plot(xx,yy);
%%
ax = gca;
ax.YLim(1) = 0;
%%
yl = ylim();
ylim([0,yl(2)]);

Más respuestas (0)

Categorías

Más información sobre Data Exploration 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