MATLAB: How an I manipulate top and bottom x axes individually

axisbottomleftrighttickstop

I want to control the x axis top and bottom individually / separately.
Specifically I want to point the bottom x axis ticks out and the top x axis ticks in ( and point left y axis out and right y axis in).

Best Answer

Actually, dpb's suggestion of 2 axes should work as long as you don't turn "box on", and you may need to sync their positions if you do things like add axis labels, etc.
fig = figure;
ax(1) = axes(fig,'Color','none');
ax(2) = axes(fig,'Color','none');
ax(2).YAxisLocation = 'right';
ax(2).XAxisLocation = 'top';
ax(2).XAxis.TickDirection = 'out'
ax(1).YAxis.TickDirection = 'out'