フィルターのクリア

How to create an empty plotting area, with log X axis?

12 ビュー (過去 30 日間)
Housam Mohammad
Housam Mohammad 2023 年 6 月 11 日
コメント済み: Housam Mohammad 2023 年 6 月 12 日
This is the code:
xlim([0.01,100000]);
ylim([0,1]);
grid on
grid minor
axes('XLim',[0.01,100000], 'YLim',[0,2], 'XGrid','on', 'YGrid','on')
yline(1)
set(gca, 'XScale', 'log')
set(gca, 'YTicklabel',[])
yticks([0 1 2])
yticklabels({'0' '1' '2'});
I just want to get rid of the numbers [0 1 2 3 ... 10] on the x axis, and [0.1 0.2 ...1] on the y axis.
Thanks in advance.
  1 件のコメント
Diwakar Diwakar
Diwakar Diwakar 2023 年 6 月 11 日
xlim([0.01, 100000]);
ylim([0, 1]);
grid on;
grid minor;
axes('XLim',[0.01, 100000], 'YLim',[0, 2], 'XGrid','on', 'YGrid','on');
yline(1);
set(gca, 'XScale', 'log');
set(gca, 'XTick', []); % Remove X tick labels
set(gca, 'YTick', []); % Remove Y tick labels
yticks([0 1 2]);
yticklabels({'0', '1', '2'});

サインインしてコメントする。

採用された回答

VBBV
VBBV 2023 年 6 月 11 日
編集済み: VBBV 2023 年 6 月 11 日
If you use xlim & ylim it creates an empty plot with axes information having that range specified. Make them empty
xlim([0.01,100000]);
ylim([0,1]);
% call the axes information corresponding to xlim and ylim,
ax = gca;
% set them to empty
set(gca,'YTicklabel',[],'XTicklabel',[])
grid on
grid minor
axes('XLim',[0.01,100000], 'YLim',[0,2], 'XGrid','on', 'YGrid','on')
yline(1)
set(gca, 'XScale', 'log')
set(gca, 'YTicklabel',[])
yticks([0 1 2])
yticklabels({'0' '1' '2'});
  4 件のコメント
Dyuman Joshi
Dyuman Joshi 2023 年 6 月 11 日
@Housam Mohammad, In case you also want to remove the ticks corresponding to the numbers you mentioned -
xlim([0.01,100000]);
ylim([0,1]);
% call the axes information corresponding to xlim and ylim,
ax = gca;
% set them to empty
set(gca,'YTicklabel',[],'XTicklabel',[])
grid on
grid minor
axes('XLim',[0.01,100000], 'YLim',[0,2], 'XGrid','on', 'YGrid','on')
yline(1)
set(gca, 'XScale', 'log')
set(gca, 'YTicklabel',[])
yticks([0 1 2])
yticklabels({'0' '1' '2'});
set(gca,'XMinorTick','off')
set(gca,'YMinorTick','off')
Housam Mohammad
Housam Mohammad 2023 年 6 月 12 日
Thank you @Dyuman Joshi, that's helpful too.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAxis Labels についてさらに検索

製品


リリース

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by