I would like axis off except xlabel, but this is not working, why?

29 ビュー (過去 30 日間)
Mr M.
Mr M. 2015 年 7 月 7 日
コメント済み: Azzi Abdelmalek 2015 年 7 月 7 日
This is not working for me: axis off; xlabel('something');

回答 (2 件)

Azzi Abdelmalek
Azzi Abdelmalek 2015 年 7 月 7 日
set(gca,'xtick',[],'ytick',[],'title',[],'ylabel',[]),
  2 件のコメント
Mr M.
Mr M. 2015 年 7 月 7 日
This is not working for me: "invalid object handle" Maybe, the problem is that I am in a subfigure. ?
Azzi Abdelmalek
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
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 件のコメント
Mr M.
Mr M. 2015 年 7 月 7 日
編集済み: Mr M. 2015 年 7 月 7 日
It is not possible, what you have written. The error message is: "Warning: Struct field assignment overwrites a value with class "double". See MATLAB R14SP2 Release Notes, Assigning Nonstructure Variables As Structures Displays Warning, for details. > In myprog at 68
ax =
XLabel: [1x1 struct]"
Mike Garrity
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 ExchangeAxis Labels についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by