how to show minor gridlines?

408 ビュー (過去 30 日間)
Roger
Roger 2014 年 12 月 28 日
編集済み: dpb 2014 年 12 月 28 日
i have these commands, i think the order of execution may affect showing the grid lines, how to order them or better ways ?
ylim([1e-3 1e7])
xlim([-3 10])
set(gca,'ytick',10.^([ -2 0 2 4 6]))
set(gca,'xtick',10.^([-3 -2 -1 0 1]))
set(gca,'yticklabel',20.*log10(get(gca,'ytick')))
set(gca,'xscale','log','yscale','log')
grid(gca,'minor')
grid on
set(gca, 'YMinorTick','on', 'YMinorGrid','on')

採用された回答

dpb
dpb 2014 年 12 月 28 日
編集済み: dpb 2014 年 12 月 28 日
Per
doc grid
grid(gca,'minor')
toggles the state of the minor grids and
grid on
turns only the major grid on. As the footnote says, use
hAx=gca; % avoid repetitive function calls
set(hAx,'xminorgrid','on','yminorgrid','on')
to unequivocally set them in 'on' position
ADDENDUM
It would seem a reasonable enhancement request to add the 'ON|OFF' values to the 'MINOR' keyword to provide the specific functionality of
set(hAx,'xminorgrid','on','yminorgrid','on')

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeResizing and Reshaping Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by