Borrar filtros
Borrar filtros

Show only a part of the yaxis

5 visualizaciones (últimos 30 días)
Sim
Sim el 3 de Jul. de 2023
Comentada: Les Beckham el 4 de Jul. de 2023
How can I show only a part of the yaxis (i.e. from zero to infinity), as shown in the right figure, here below?
My desired output is the figure on the right. The original figure comes from
https://stackoverflow.com/questions/1490778/how-to-show-x-and-y-axes-in-a-matlab-graph

Respuesta aceptada

Les Beckham
Les Beckham el 3 de Jul. de 2023
Editada: Les Beckham el 3 de Jul. de 2023
Here is a kind of messy workaround. Note that this doesn't work if you have the grid on.
h = plot(linspace(-2, 2, 1000), atan(linspace(-2, 2, 1000)));
set(gca, 'XAxisLocation', 'origin', 'YAxisLocation', 'origin');
% draw a white line over the top of the bottom half of the y axis
line([0 0], [0 min(ylim)], 'Color', [1 1 1]);
set(gca, 'Ytick', [0 0.5 1]) % turn off the y ticks at -1 and -0.5
  4 comentarios
Sim
Sim el 4 de Jul. de 2023
That's great @Les Beckham!! :-) Many Many thanks :-)
Les Beckham
Les Beckham el 4 de Jul. de 2023
Of course. Have a great day.

Iniciar sesión para comentar.

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by