plots with xlabel too long of a string for the plot

3 Ansichten (letzte 30 Tage)
Adam Jurhs
Adam Jurhs am 10 Mai 2022
Kommentiert: Rik am 10 Mai 2022
hi,
i need to make a plot that has doubles for the y-axis and strings for the x-axis
1,'abc'
2,'def'
3,'ghi'
4,'jkl'
5,'mno'
...
i've been plotting using the index as the x-axis and using xlabel ('abc def ghi jkl mno ...') to give them a name. the problem is that the strings don't line up with the index and the length when plotted have gotten longer than the size of the plot. i'm thinking i could rotate the strings at a 45* angle, but i don't know how to do that). hints?

Akzeptierte Antwort

Prakash S R
Prakash S R am 10 Mai 2022
Bearbeitet: Prakash S R am 10 Mai 2022
set(gca, 'XTickLabels', {'abc' 'def' 'ghi' 'jkl' 'mno' ..}) ;
xtickangle(45)

Weitere Antworten (1)

Adam Jurhs
Adam Jurhs am 10 Mai 2022
awesome, thanks! worked perfectly
  2 Kommentare
Prakash S R
Prakash S R am 10 Mai 2022
Awesome! Please "Accept" the response that was helpful, if you could :)
Rik
Rik am 10 Mai 2022
You also posted this as a comment. Feel free to delete it and repost it as a comment.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Geographic Plots finden Sie in Help Center und File Exchange

Produkte


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by