MATLAB Answers

How can i modify the values on the y axis ?

조회 수: 1(최근 30일)
Anas Abid
Anas Abid 2021년 7월 19일
댓글: Mathieu NOE 2021년 7월 22일
Hello everyone!
I was wondering if it were possible to modify the numbers on the y axis, while maintaining the plot as it already is.
For example here :
Is it possible at the 200 mark on the y axis to reset it to 0, 225 to 25, 275 to 50 etc... And the same for 400 (set it at 0) ?
  댓글 수: 3
Anas Abid
Anas Abid 2021년 7월 21일
The issue with subplot was the spacing between plots as you mentionned. I tried using a GUI with multiple axes stacked one on another and it worked out well though i will try out stacked plot also.

댓글을 달려면 로그인하십시오.

답변(1개)

dpb
dpb 2021년 7월 19일
편집: dpb 2021년 7월 19일
You can label the ticks however you wish --
yticklabels(yticks-200);
However, that doesn't change the data of course so the datatip cursor will still show the actual data values.
You would have to plot(x,y-200) to do that easily; otherwise I presume there's a way one could manage to write a callback function but I've not explored that aspect.
ADDENDUM:
Above changes them all, overlooked the details of the plot, sorry.
I think stackedplot is probably the built in solution that comes closest to wished-for look.
  댓글 수: 3

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

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

Start Hunting!

Translated by