How to remove tick label from y axis
Mostrar comentarios más antiguos
Hi,
I have a y axis with labels on the y axis -1 -0.5 0 0.5 1 1.5 2 2.5 3 3.5 I want to remove the first origin label -1. How do I do that?
I have done it with the X axis by the following: set(gca,'XTick',x(2:end)); set(gca,'XTickLabel',x(2:end),'fontsize',14);
but when I try with the y axis I get an error message as follows:
Error using set Values must be monotonically increasing
regards James
Respuestas (2)
Image Analyst
el 12 de Nov. de 2013
Does this do the trick for you:
plot(1:10)
set(gca,'YTickLabel',[]);
3 comentarios
Kevin Cahill
el 8 de Jun. de 2017
Thanks. Just what I needed.
__init__.py
el 28 de Mayo de 2024
What is the reverse operation to this?
@__init__.py You can set up tick labels to be "auto" or whatever custom labels you want with the yticklabels function.
help yticklabels
The Matlab Spot
el 12 de Nov. de 2013
Hello James, I tried your problem statement in the following example.
fh = plot(-10:10);
axis = get(fh,'Parent');
yTick = get(axis,'YTick');
set(axis,'YTick',yTick(2:end));
It did not give the error while setting the values as the axis YTickLabels get automatically updated when you update the YTick values.
Can you give more details of the scenario what you are facing?
Categorías
Más información sobre Axis Labels en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!