How to create an empty plotting area, with log X axis?
12 ビュー (過去 30 日間)
古いコメントを表示
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
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
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
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')
その他の回答 (0 件)
参考
カテゴリ
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!