Add Specific Numbers to x-axis

36 visualizaciones (últimos 30 días)
Brave A
Brave A el 27 de Feb. de 2021
Comentada: Cris LaPierre el 27 de Feb. de 2021
Hello
I would like to add/show specific numbers in x-axis.Like numbers I showed here 52 and last number 142.

Respuesta aceptada

Cris LaPierre
Cris LaPierre el 27 de Feb. de 2021
Use the xticks and possibly xticklabels function.
x=0:142;
y=linspace(0.1, 2.7,length(x));
bar(x,y)
xline(52,'m--')
xticks(sort([xticks 52 142]));
  4 comentarios
Brave A
Brave A el 27 de Feb. de 2021
One more question please, how to remove 0/zeros from axis?
Cris LaPierre
Cris LaPierre el 27 de Feb. de 2021
Which zeros do you want removed?
You could either
  • delete or rename the tick label
  • delete or move the tick
  • change you axis limits to not include 0

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by