Plot only for positive y
8 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
alpedhuez
el 12 de Jun. de 2018
Comentada: Jack
el 14 de Mayo de 2023
I have
plot(x,y)
hold on
plot(x,z)
hold on
plot(x,w)
I need to have a plot for only positive y and z. I try to write
ylim([0,yMax])
But I do not know how to set for yMax. Please advise.
2 comentarios
Respuesta aceptada
OCDER
el 12 de Jun. de 2018
Editada: OCDER
el 13 de Jun. de 2018
NEW ANSWER
ylim([0 inf]) %Will automatically compute the limit where "inf" is used
OLD ANSWER
ylim([0, max([y(:); z(:); w(:)]))
%will plot positive values of y axis from 0 to the maximum of either your y or z or w values.
3 comentarios
OCDER
el 13 de Jun. de 2018
Actually, there was an easier solution. I'll update the answer:
ylim([0 inf]) %will automatically compute the limit where "inf" is used
Jack
el 14 de Mayo de 2023
this doesnt seem to work on my graph bit confused any ideas how I could be messing it up? im putting it after the plot(x,y) and have tried after title labels and after hold on so bit confused.
Más respuestas (0)
Ver también
Categorías
Más información sobre Creating, Deleting, and Querying Graphics Objects en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!