Hi everyone.
Does anyone knows how to display a single point (x, y), for instance (2.899, -3.677), on a curve plot?
It´s possible to display points on plotting curves using getCursorInf( ) method but I prefer using other approashs.

回答 (1 件)

Star Strider
Star Strider 2019 年 4 月 11 日

0 投票

I would simply do:
figure
plot(curve_x, curve_y, '-b')
hold on
plot(2.899, -3.677, 'r+')
hold off
grid
That would plot the curve with a solid blue line, and the single point with a red plus sign.

4 件のコメント

Rafael Espírito Santo
Rafael Espírito Santo 2019 年 4 月 15 日
Thanks Star Strider
Instead of plotting a red plus sign on x = 2.899 and y = -3.677, I would like to plot (2.899, -3.677) on x = 2.899 and y = -3.677.
Star Strider
Star Strider 2019 年 4 月 15 日
Try this:
figure
plot(curve_x, curve_y, '-b')
point = [2.899, -3.677];
text(point(1), point(2), sprintf('(%.3f,%.3f)', point))
grid
See the documentation for the text (link) function for details.
Rafael Espírito Santo
Rafael Espírito Santo 2019 年 4 月 15 日
It´s work Star Strider.
Thank you very much indeed.
Star Strider
Star Strider 2019 年 4 月 15 日
My pleasure.
If my Answer helped you solve your problem, please Accept it!

サインインしてコメントする。

カテゴリ

製品

リリース

R2015a

質問済み:

2019 年 4 月 11 日

コメント済み:

2019 年 4 月 15 日

Community Treasure Hunt

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

Start Hunting!

Translated by