How do I place a point anywhere along x axis (with range 100m) in a plot?

1 回表示 (過去 30 日間)
Tunde Adubi
Tunde Adubi 2023 年 4 月 30 日
コメント済み: Adam Danz 2023 年 5 月 1 日
Assuming I have a plot with x axis ranging from 0 to 100meters.
How do I place a point 'k' indicating 53m on the x axis?

採用された回答

Torsten
Torsten 2023 年 4 月 30 日
移動済み: Torsten 2023 年 4 月 30 日
x0 = 53;
y0 = 0;
plot(x0,y0,'o')
ylim([0 1])
xlim([0 100])
  3 件のコメント
Walter Roberson
Walter Roberson 2023 年 4 月 30 日
See hold
Adam Danz
Adam Danz 2023 年 5 月 1 日
If you want the marker to stay on the x axis even if the y-limit changes, you can use the LimitsChangedFcn to update the y-coordinates of the point any time the axis limits change.

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

その他の回答 (1 件)

John D'Errico
John D'Errico 2023 年 4 月 30 日
編集済み: John D'Errico 2023 年 4 月 30 日
Highly confusing. Do you want to plot a single point? What y value? Maybe you want to do this?
k = 53;
plot(k,0,'ro') % A single point at x==k==53
xlim([0,100])
Or, maybe you want this?
figure
xlim([0,100])
xline(k,'r') % A vertical line
Do you just want to display a horizontal number line? So no y axis at all?
plot(k,0,'ro') % A single point at x==k==53
xlim([0,100])
H = get(gca);
H.YAxis.Visible = 'off';
I could probably do better than that. But I have no idea what you are looking to see. Again, a confusing question.

カテゴリ

Help Center および File ExchangeLine Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by