plot - Remove ticks from 1st axis on 2nd axis in MATLAB when using plotyy and axes limits -


i trying use matlabs plotyy function in combination y-axes limits that

x = [4:2:14 18]; y1 = [86; 87; 88; 89; 89.3; 89.6; 89.7]; y2 = [15; 35; 63; 99; 143; 195; 323]; width = .36; axes = plotyy(x-width, y1, x+width, y2, @(x,y) bar(x,y,width,'b'), @(x,y) bar(x,y,width,'r')); set(axes(1), 'ylim', [85 90]); set(axes(1), 'ytick', 85:90); set(axes(2), 'ytick', 0:50:400); set(axes,'xtick',x) 

and result:

the plotyy result wrong ticks

what want rid of ticks on 2nd y-axis don't have tick label. seem leftovers 1st y-axis. how can remove them or avoid them drawn?

based on code example in this question, should is:

set(axes(1),'box','off'); 

however, removes top line. if need keep line, see answer question well.


Comments