Customize tick values in boxplot

Hey,
I have the following boxplot:
Instead of 1, 2, 3 on the x-axis I want to have 50kW, 150kW, 300kW - I tried changing tick-values to either only 50, 150, 300 or with kW. Both wont work, as obviously these are not regular tick values. Is there a way to customize it, to have it display what I need?

 Respuesta aceptada

Adam Danz
Adam Danz el 5 de Mayo de 2021
Editada: Adam Danz el 5 de Mayo de 2021
Use the Labels input option.
boxplot(rand(20,3),'Labels',compose('%dkW',[50,150,300]))
> I tried changing tick-values
You would need to change the xticklabel property.
set(gca, 'xtick',1:3,'XTickLabels',compose('%dkW',[50,150,300]))

3 comentarios

Lukas Netzer
Lukas Netzer el 6 de Mayo de 2021
Thank you very much!
One more question If I may - how can I have letters in my compose?
like that:
compose('C1;',[abc, def,ghj])
to get those labels:
C1abc C1def C1ghj

Iniciar sesión para comentar.

Más respuestas (0)

Preguntada:

el 5 de Mayo de 2021

Comentada:

el 6 de Mayo de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by