Adding label to axis ticks

2 visualizaciones (últimos 30 días)
Yi-xiao Liu
Yi-xiao Liu el 30 de Sept. de 2020
Comentada: Yi-xiao Liu el 2 de Oct. de 2020
How do I add labels next to the 3 180 xticks? Like sampleA for the first one, sampleB for the second, etc. Thanks!
>> xt = xticks
xt =
Columns 1 through 5
0 180 360 450 630
Columns 6 through 9
810 900 1080 1260
>> xtl=xticklabels
xtl =
9×1 cell array
{'0' }
{'180'}
{'360'}
{'0' }
{'180'}
{'360'}
{'0' }
{'180'}
{'360'}
  1 comentario
madhan ravi
madhan ravi el 30 de Sept. de 2020
xticklabels('SampleA, ...) %?

Iniciar sesión para comentar.

Respuesta aceptada

Adam Danz
Adam Danz el 30 de Sept. de 2020
Editada: Adam Danz el 1 de Oct. de 2020
Set the XTickLabel propery of the axis. Use newline to break apart a string into multiple lines.
Quick demo:
ax = cla();
ax.XLim = [0,4];
ax.XTick = 1:3;
ax.XTickLabel{2} = '180\newline A';
"\newline" inserts a line break within the label.

Más respuestas (0)

Categorías

Más información sobre Data Distribution Plots en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by