How to make axis line invisible but keep xlabel and ylabel?
47 次查看(过去 30 天)
显示 更早的评论
采纳的回答
jonas
2018-7-23
编辑:jonas
2018-7-23
h=get(gca);
set(h,'xcolor','none')
h.XAxis.Label.Color=[0 0 0];
h.XAxis.Label.Visible='on';
6 个评论
Walter Roberson
2021-3-12
imagesc(rand(32,40))
xlabel('x')
ylabel('y')
zlabel('z')
h = gca; %fixed relative to jonas's suggestion
set(h,'xcolor','none')
h.XAxis.Label.Color=[0 0 0]; h.XAxis.Label.Visible='on';
The y label ticks are visible; the x label ticks are not; the x label itself is visible.
However, I have not tried this in R2019b.
Adam Danz
2021-4-19
Another approach:
ax.XRuler.Axle.Visible = 'off'; % ax is axis handle
ax.YRuler.Axle.Visible = 'off';
Credit: Yair's UndocumentedMatlab
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!