How to plot discrete values on the x-axis.
15 views (last 30 days)
Show older comments
DAVIDE DELLA VALLE
on 13 Oct 2020
Commented: Ameer Hamza
on 13 Oct 2020
Hello everybody,
I haven't figured out yet how can I plot discrete values along the x-axis. I need to plot for instance:
y= [10 1 2 3 20 22 20 10 14 12];
x = [89 89 89 89 89 89 89 90 91 10];
Accepted Answer
Ameer Hamza
on 13 Oct 2020
Edited: Ameer Hamza
on 13 Oct 2020
Try this
y = [10 1 2 3 20 22 20 10 14 12];
x = [89 89 89 89 89 89 89 90 91 10];
ax = axes();
plot(y, 'r+', 'MarkerSize', 10, 'LineWidth', 2)
ax.XTickLabel = string(x);
8 Comments
More Answers (0)
See Also
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!