I would like axis off except xlabel, but this is not working, why?
30 次查看(过去 30 天)
显示 更早的评论
This is not working for me: axis off; xlabel('something');
0 个评论
回答(2 个)
Azzi Abdelmalek
2015-7-7
set(gca,'xtick',[],'ytick',[],'title',[],'ylabel',[]),
2 个评论
Azzi Abdelmalek
2015-7-7
Try this
h=findobj(gcf,'type','axes')
for k=1:numel(h)
set(h(k),'xtick',[],'ytick',[],'title',[],'ylabel',[]),
end
Mike Garrity
2015-7-7
The axis('off') command turns off the visibility of all of the decorations of the axes. You need to turn the one you want back on:
ax = gca
axis(ax,'off')
xlabel(ax,'something')
ax.XLabel.Visible = 'on'
3 个评论
Mike Garrity
2015-7-7
Sorry, the . notation was introduced in R2014b. It sounds like you're running an earlier version. Something like this should work in both versions:
ax = gca
axis(ax,'off')
xlabel(ax,'something')
set(get(ax,'XLabel'),'Visible','on')
I generally use the dot notation because it's so much easier to read.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Axis Labels 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!