Hey, i know how to plot lines and functions etc. and am struggling on a real simple step.
I'd like to mark or plot a single point like "y=0 x =100" in a certain color.
It would be even great to write a short Text over or under this point like (X_CP).
Hope someone can solve this Problem.
Have a nice day and best regards,
Ermanno

 채택된 답변

Cris LaPierre
Cris LaPierre 2020년 7월 10일

0 개 추천

You have to add a second plot to your figure using hold on, and plot just the single point with your desired color and line style.
Using the x,y coordinates of that point, you can use the text function to add a custom label for that point to your figure.

댓글 수: 5

hey, yeah i know but how do i plot a single point with coordinates, with my desired color etc. would you mind giving me a short example? i can't find any command.
The same way you plot a line, which you said you knew how to do, but with a single x and single y coordinate. If you need a refresher, check out the documentation for plot.
Ermanno Manca
Ermanno Manca 2020년 7월 10일
편집: Ermanno Manca 2020년 7월 10일
Unfortunately that doesn't work.
x_CG is a point.
I tried " line (app.UIAxes,x_CG,0,'r'); " before and it always gives me an error.
Perhaps a simple example adapted from here.
x = 0:pi/100:2*pi;
y = sin(x);
plot(x,y)
hold on
plot(1.5,0,'rs')
hold off
text(1.5,0.1,"x_CG","Interpreter", "none")
Ermanno Manca
Ermanno Manca 2020년 7월 11일
편집: Ermanno Manca 2020년 7월 11일
Thanks a lot. It really helped me out!

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Annotations에 대해 자세히 알아보기

질문:

2020년 7월 10일

편집:

2020년 7월 11일

Community Treasure Hunt

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

Start Hunting!

Translated by