yyaxis 'right' - can I have tick marks on both sides?
16 views (last 30 days)
Show older comments
I'm creating a figure to illustrate data availability/quality. It's one plot with no subplots. See attached.
I add a small plot at the bottom of the main plot using yyaxis 'right' and fiddling with the y limits. I can't work out how to put the tick marks and labels on both sides for just this bottom plot.
Can this be done?
Here is the relevant part of my script - it is not possible to share the whole script and the data here.
figure;
plot( XP1, YP1, 'b|', 'MarkerSize', 10 );
plot( XP2, YP2, 'r|', 'MarkerSize', 10 );
stations = [ "MSCP (0.7km)"; "MSUH (1.0km)"; "MSS1 (1.3km)"; "MBFR (2.0km)"; "MBLG (2.1km)"; "MBLY (2.1km)"; "MBRY (2.4km)"; ...
"MBBY (3.3km)"; "MBHA (3.5km)"; "MSMX (3.7km)"; "MBGH (3.8km)"; "MBWH (3.9km)"; "MBWW (5.0km)" ];
nsta = length( stations );
ylim( [0 nsta+2] );
yticks( 1:nsta );
yticklabels( stations );
h=gca;
h.YAxis.TickLength = [0 0];
h.XAxis.TickLength = [0 0];
set(h, 'Ydir', 'reverse');
box on;
yyaxis right;
bar( ngoodSta, 1.0, 'k' );
ylim( [0 60] );
yticks( [0 2 4] );
ax = gca;
ax.YAxis(2).Color = 'k';
2 Comments
Answers (0)
See Also
Categories
Find more on Axis Labels in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!