How do I place a point anywhere along x axis (with range 100m) in a plot?
Show older comments
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?
Accepted Answer
More Answers (1)
John D'Errico
on 30 Apr 2023
Edited: John D'Errico
on 30 Apr 2023
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.
Categories
Find more on Line 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!


