xticklabels function for more than 11 labels ?
Mostrar comentarios más antiguos
Hello everyone ,
I need to use the function "xticklabels" for labeling the x-axis this is my code:
figure (1)
xticklabels({'jan','feb','mar','apr','may','jun','jul','aug','sep','oct','nov','dec'})
but the figure display only till 'nov' how can I include the last one ?
Thank you.
Respuesta aceptada
Más respuestas (1)
Mandeep Singh
el 10 de Jul. de 2018
From my understanding of the problem, you could specify the xticks before xticklabel to get the desired output . Try the following example snippet:
xticks(1:12)
xticklabels({'jan','feb','mar','apr','may','jun','jul','aug','sep','oct','nov','dec'})
The value of the xticks can be varied according to the data you are plotting.
3 comentarios
Reema Alhassan
el 10 de Jul. de 2018
The problem is that when you create a default figure, then matlab makes an axis with xlim=[0 1] with 11 equally spaced xtick. You can just change the xlim to get your desired results, but for almost any application I would suggest using Jan's method instead.
Reema Alhassan
el 10 de Jul. de 2018
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!