How to set the grid line of y-axis by 5 ?
8 ビュー (過去 30 日間)
古いコメントを表示
I want to add a grid on my plot. Unofrtunetely, I found only Grid normal and Grid miror,
I want to add a grid that appear every 5 value on y-axis, for example:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1074890/image.png)
0 件のコメント
回答 (2 件)
Voss
2022 年 7 月 23 日
Maybe something like this?
ax = gca();
set(ax, ...
'XLim',[0.7 4.5], ...
'YLim',[0 40], ...
'XTick',1:4, ...
'YTick',0:5:40, ...
'GridColor','r', ...
'XGrid','on', ...
'YGrid','on');
ytl = get(ax,'YTickLabels');
ytl(2:2:end) = {''};
set(ax,'YTickLabels',ytl);
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!