How to change the x-axis step size?
8 views (last 30 days)
Show older comments
I have this code, everything is fine but I tried to change x-axis step size in order to be 1 instead of 0.5, but it didn't work!
clear;
SF=[12 11 10 9 8 7];
TOA=[1318.91 741.38 370.69 185.34 102.91 56.58];
R_b=[0.29 0.54 0.98 1.76 3.12 5.47];
%Plotting
set ( gca, 'xdir', 'reverse' )
yyaxis left
stairs(SF,TOA,'-.')
title('Distance <----')
xlabel('SF')
ylabel('TOA (msec)')
yyaxis right
stairs(SF,R_b,'r')
ylabel('Data Rate (kbps)')
legend('TOA','Data Rate')
grid
0 Comments
Accepted Answer
Star Strider
on 24 Jun 2021
Add 'XTick' to the set call —
set ( gca, 'xdir', 'reverse', 'XTick',fliplr(SF) )
SF=[12 11 10 9 8 7];
TOA=[1318.91 741.38 370.69 185.34 102.91 56.58];
R_b=[0.29 0.54 0.98 1.76 3.12 5.47];
%Plotting
figure
set ( gca, 'xdir', 'reverse', 'XTick',fliplr(SF) )
yyaxis left
stairs(SF,TOA,'-.')
title('Distance <----')
xlabel('SF')
ylabel('TOA (msec)')
yyaxis right
stairs(SF,R_b,'r')
ylabel('Data Rate (kbps)')
legend('TOA','Data Rate')
grid
.
4 Comments
Abdou
on 17 Sep 2024
Hi @Star Strider, side question! What's the font you're using in the plot? and how are you specifiying for the whole plot? Thanks
Star Strider
on 17 Sep 2024
The font iis whatever the default font is set in the online version. It seems to be Helvetica.
hf = axes;
% hf.Visible = 'off';
hf.FontName
‘... how are you specifiying for the whole plot?’
I don’t understand what you’re referring to.
.
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
