How to draw a line from the variable y-axis

1 ビュー (過去 30 日間)
Martin Olafsen
Martin Olafsen 2017 年 11 月 6 日
コメント済み: Martin Olafsen 2017 年 11 月 6 日
Hi
I am making a 2D plot. The x-axis is located at y = 0, but I do not know the position of the y-axis, it depends on the results. Is there a way to find the x position of the y-axis? (I do not want a fixed location of the y-axis, as it should depend on the results.)
Regards
  2 件のコメント
Martin Olafsen
Martin Olafsen 2017 年 11 月 6 日
編集済み: Martin Olafsen 2017 年 11 月 6 日
Ok. I'm trying to make a line from the x-axis to my chosen result point, and a line from the y-axis to the result. For a line from the x-axis I did this:
plot([resultX resultX], [0 resultY])
For a line from the y-axis I would do something of the nature to:
plot(["(y-axis location on x-axis)" resultX],[resultY resultY])
I do not know what to use for y-axis location on x-axis, as the location varies. I don't quite understand what information is missing, hopefully this clears it up.

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

採用された回答

Image Analyst
Image Analyst 2017 年 11 月 6 日
You can use xlim() and ylim() to determine the limits of the axes that MATLAB used and drew on your graph
xLimits = xlim();
yLimits = ylim();
  1 件のコメント
Martin Olafsen
Martin Olafsen 2017 年 11 月 6 日
Perfect, thank you very much.

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

その他の回答 (0 件)

カテゴリ

Find more on 2-D and 3-D Plots in Help Center and File Exchange

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by