set the Ticks only on the X and Y axis
8 次查看(过去 30 天)
显示 更早的评论
How can I set the Ticks only on the X and Y axis as shown in the following image:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/162952/image.png)
0 个评论
采纳的回答
Star Strider
2017-4-14
Set the axis box to 'off'.
Example —
x = 0:20;
y = sin(x*pi/9);
figure(1)
plot(x, y);
grid
ha = gca;
ha.Box = 'off';
See if that does what you want to do.
2 个评论
Star Strider
2017-4-15
if you want the lines but not the ticks, you have to plot each of them separately as lines:
x = 0:20;
y = sin(x*pi/9);
figure(1)
plot(x, y);
hold on
plot(xlim, [1 1]*max(ylim), '-k') % Top Box Limit Without Ticks
plot([1 1]*max(xlim), ylim, '-k') % Right Box Limit Without Ticks
hold off
grid
hax = gca;
hax.Box = 'off';
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!