How do I change the values for x-axis ?

조회 수: 287 (최근 30일)
Anne-Lise Marais
Anne-Lise Marais 2021년 1월 13일
답변: Anne-Lise Marais 2021년 1월 18일
Hi all,
here is my code with the figure
MoyenneDeviant=mean(Deviant,2);
plot(MoyenneDeviant)
legend ("deviant")
But the values of the x axis are not the one i wanted
after reading an answer to a similar question, I wrote this code to replace the ticks by other
xticks([0 50 100 150 200 250])
set(gca,'XLim',[-100 900]);
set(gca,'YLim',[-3 3]);
set(gca,'Xtick',[-100 100 300 500 700 900])
but it changed the scale instead of the values.
How do I get to change the values by the ones I want ?
MATLAB 2017a
Thanks

채택된 답변

Anne-Lise Marais
Anne-Lise Marais 2021년 1월 18일
I used this function
xticklabels({'-100', '100','300','500','700','900'})
here is the result

추가 답변 (1개)

Mischa Kim
Mischa Kim 2021년 1월 13일
편집: Mischa Kim 2021년 1월 13일
Hi Anne-Lise, do you mean changing the tick labels? See this answer. If this does not address your question, how exactly do you want "to change the values by the ones I want"?

카테고리

Help CenterFile Exchange에서 Axis Labels에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by