Add lines along the axes
36 views (last 30 days)
Show older comments
I need to add lines along the x and y axes, but I don't want to move the entire axis to the origin. (essentially gridlines, but only at x=0 and y=0) Is this doable easily?
0 Comments
Accepted Answer
Star Strider
on 29 Sep 2018
I am not certain what you want.
Try this:
x = linspace(-2, 5, 250);
y = sin(2*pi*x + 0.2) + 0.3;
figure
plot(x, y)
hold on
plot([0 0], ylim, '--') % Dashed Vertical Line at x=0
plot(xlim, [0 0], '--') % Dashed Horizontal Line at y=0
hold off
grid
1 Comment
Steven Lord
on 30 Sep 2018
More Answers (0)
See Also
Categories
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!